summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt20
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/audio_core/CMakeLists.txt15
-rw-r--r--src/audio_core/adsp/adsp.cpp18
-rw-r--r--src/audio_core/adsp/adsp.h50
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp220
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/audio_renderer.h116
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/command_buffer.h23
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp (renamed from src/audio_core/renderer/adsp/command_list_processor.cpp)29
-rw-r--r--src/audio_core/adsp/apps/audio_renderer/command_list_processor.h (renamed from src/audio_core/renderer/adsp/command_list_processor.h)21
-rw-r--r--src/audio_core/adsp/mailbox.h69
-rw-r--r--src/audio_core/audio_core.cpp4
-rw-r--r--src/audio_core/audio_core.h6
-rw-r--r--src/audio_core/audio_event.cpp1
-rw-r--r--src/audio_core/audio_in_manager.cpp2
-rw-r--r--src/audio_core/audio_in_manager.h4
-rw-r--r--src/audio_core/audio_out_manager.cpp2
-rw-r--r--src/audio_core/audio_out_manager.h3
-rw-r--r--src/audio_core/audio_render_manager.cpp4
-rw-r--r--src/audio_core/audio_render_manager.h4
-rw-r--r--src/audio_core/common/audio_renderer_parameter.h6
-rw-r--r--src/audio_core/renderer/adsp/adsp.cpp117
-rw-r--r--src/audio_core/renderer/adsp/adsp.h171
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.cpp225
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.h204
-rw-r--r--src/audio_core/renderer/adsp/command_buffer.h21
-rw-r--r--src/audio_core/renderer/audio_device.cpp4
-rw-r--r--src/audio_core/renderer/audio_device.h4
-rw-r--r--src/audio_core/renderer/audio_renderer.cpp4
-rw-r--r--src/audio_core/renderer/audio_renderer.h6
-rw-r--r--src/audio_core/renderer/behavior/behavior_info.cpp4
-rw-r--r--src/audio_core/renderer/behavior/behavior_info.h8
-rw-r--r--src/audio_core/renderer/behavior/info_updater.cpp4
-rw-r--r--src/audio_core/renderer/behavior/info_updater.h4
-rw-r--r--src/audio_core/renderer/command/command_buffer.cpp4
-rw-r--r--src/audio_core/renderer/command/command_buffer.h4
-rw-r--r--src/audio_core/renderer/command/command_generator.cpp4
-rw-r--r--src/audio_core/renderer/command/command_generator.h4
-rw-r--r--src/audio_core/renderer/command/command_list_header.h4
-rw-r--r--src/audio_core/renderer/command/command_processing_time_estimator.cpp4
-rw-r--r--src/audio_core/renderer/command/command_processing_time_estimator.h4
-rw-r--r--src/audio_core/renderer/command/data_source/adpcm.cpp24
-rw-r--r--src/audio_core/renderer/command/data_source/adpcm.h23
-rw-r--r--src/audio_core/renderer/command/data_source/decode.cpp110
-rw-r--r--src/audio_core/renderer/command/data_source/decode.h4
-rw-r--r--src/audio_core/renderer/command/data_source/pcm_float.cpp28
-rw-r--r--src/audio_core/renderer/command/data_source/pcm_float.h23
-rw-r--r--src/audio_core/renderer/command/data_source/pcm_int16.cpp28
-rw-r--r--src/audio_core/renderer/command/data_source/pcm_int16.h23
-rw-r--r--src/audio_core/renderer/command/effect/aux_.cpp12
-rw-r--r--src/audio_core/renderer/command/effect/aux_.h13
-rw-r--r--src/audio_core/renderer/command/effect/biquad_filter.cpp14
-rw-r--r--src/audio_core/renderer/command/effect/biquad_filter.h13
-rw-r--r--src/audio_core/renderer/command/effect/capture.cpp12
-rw-r--r--src/audio_core/renderer/command/effect/capture.h13
-rw-r--r--src/audio_core/renderer/command/effect/compressor.cpp12
-rw-r--r--src/audio_core/renderer/command/effect/compressor.h13
-rw-r--r--src/audio_core/renderer/command/effect/delay.cpp12
-rw-r--r--src/audio_core/renderer/command/effect/delay.h13
-rw-r--r--src/audio_core/renderer/command/effect/i3dl2_reverb.cpp12
-rw-r--r--src/audio_core/renderer/command/effect/i3dl2_reverb.h13
-rw-r--r--src/audio_core/renderer/command/effect/light_limiter.cpp22
-rw-r--r--src/audio_core/renderer/command/effect/light_limiter.h19
-rw-r--r--src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp14
-rw-r--r--src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h13
-rw-r--r--src/audio_core/renderer/command/effect/reverb.cpp12
-rw-r--r--src/audio_core/renderer/command/effect/reverb.h13
-rw-r--r--src/audio_core/renderer/command/icommand.h17
-rw-r--r--src/audio_core/renderer/command/mix/clear_mix.cpp14
-rw-r--r--src/audio_core/renderer/command/mix/clear_mix.h13
-rw-r--r--src/audio_core/renderer/command/mix/copy_mix.cpp14
-rw-r--r--src/audio_core/renderer/command/mix/copy_mix.h13
-rw-r--r--src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp14
-rw-r--r--src/audio_core/renderer/command/mix/depop_for_mix_buffers.h13
-rw-r--r--src/audio_core/renderer/command/mix/depop_prepare.cpp14
-rw-r--r--src/audio_core/renderer/command/mix/depop_prepare.h13
-rw-r--r--src/audio_core/renderer/command/mix/mix.cpp12
-rw-r--r--src/audio_core/renderer/command/mix/mix.h13
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp.cpp13
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp.h13
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp13
-rw-r--r--src/audio_core/renderer/command/mix/mix_ramp_grouped.h13
-rw-r--r--src/audio_core/renderer/command/mix/volume.cpp12
-rw-r--r--src/audio_core/renderer/command/mix/volume.h13
-rw-r--r--src/audio_core/renderer/command/mix/volume_ramp.cpp13
-rw-r--r--src/audio_core/renderer/command/mix/volume_ramp.h13
-rw-r--r--src/audio_core/renderer/command/performance/performance.cpp20
-rw-r--r--src/audio_core/renderer/command/performance/performance.h13
-rw-r--r--src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp14
-rw-r--r--src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h13
-rw-r--r--src/audio_core/renderer/command/resample/resample.cpp4
-rw-r--r--src/audio_core/renderer/command/resample/resample.h4
-rw-r--r--src/audio_core/renderer/command/resample/upsample.cpp12
-rw-r--r--src/audio_core/renderer/command/resample/upsample.h13
-rw-r--r--src/audio_core/renderer/command/sink/circular_buffer.cpp14
-rw-r--r--src/audio_core/renderer/command/sink/circular_buffer.h13
-rw-r--r--src/audio_core/renderer/command/sink/device.cpp12
-rw-r--r--src/audio_core/renderer/command/sink/device.h13
-rw-r--r--src/audio_core/renderer/effect/aux_.cpp4
-rw-r--r--src/audio_core/renderer/effect/aux_.h4
-rw-r--r--src/audio_core/renderer/effect/biquad_filter.cpp4
-rw-r--r--src/audio_core/renderer/effect/biquad_filter.h4
-rw-r--r--src/audio_core/renderer/effect/buffer_mixer.cpp4
-rw-r--r--src/audio_core/renderer/effect/buffer_mixer.h4
-rw-r--r--src/audio_core/renderer/effect/capture.cpp4
-rw-r--r--src/audio_core/renderer/effect/capture.h4
-rw-r--r--src/audio_core/renderer/effect/compressor.cpp4
-rw-r--r--src/audio_core/renderer/effect/compressor.h4
-rw-r--r--src/audio_core/renderer/effect/delay.cpp4
-rw-r--r--src/audio_core/renderer/effect/delay.h4
-rw-r--r--src/audio_core/renderer/effect/effect_context.cpp4
-rw-r--r--src/audio_core/renderer/effect/effect_context.h4
-rw-r--r--src/audio_core/renderer/effect/effect_info_base.h4
-rw-r--r--src/audio_core/renderer/effect/effect_reset.h4
-rw-r--r--src/audio_core/renderer/effect/effect_result_state.h4
-rw-r--r--src/audio_core/renderer/effect/i3dl2.cpp4
-rw-r--r--src/audio_core/renderer/effect/i3dl2.h4
-rw-r--r--src/audio_core/renderer/effect/light_limiter.cpp4
-rw-r--r--src/audio_core/renderer/effect/light_limiter.h4
-rw-r--r--src/audio_core/renderer/effect/reverb.cpp4
-rw-r--r--src/audio_core/renderer/effect/reverb.h4
-rw-r--r--src/audio_core/renderer/memory/address_info.h4
-rw-r--r--src/audio_core/renderer/memory/memory_pool_info.cpp4
-rw-r--r--src/audio_core/renderer/memory/memory_pool_info.h4
-rw-r--r--src/audio_core/renderer/memory/pool_mapper.cpp4
-rw-r--r--src/audio_core/renderer/memory/pool_mapper.h4
-rw-r--r--src/audio_core/renderer/mix/mix_context.cpp4
-rw-r--r--src/audio_core/renderer/mix/mix_context.h4
-rw-r--r--src/audio_core/renderer/mix/mix_info.cpp4
-rw-r--r--src/audio_core/renderer/mix/mix_info.h4
-rw-r--r--src/audio_core/renderer/nodes/bit_array.h4
-rw-r--r--src/audio_core/renderer/nodes/edge_matrix.cpp4
-rw-r--r--src/audio_core/renderer/nodes/edge_matrix.h4
-rw-r--r--src/audio_core/renderer/nodes/node_states.cpp4
-rw-r--r--src/audio_core/renderer/nodes/node_states.h4
-rw-r--r--src/audio_core/renderer/performance/detail_aspect.cpp4
-rw-r--r--src/audio_core/renderer/performance/detail_aspect.h4
-rw-r--r--src/audio_core/renderer/performance/entry_aspect.cpp4
-rw-r--r--src/audio_core/renderer/performance/entry_aspect.h4
-rw-r--r--src/audio_core/renderer/performance/performance_detail.h4
-rw-r--r--src/audio_core/renderer/performance/performance_entry.h4
-rw-r--r--src/audio_core/renderer/performance/performance_entry_addresses.h4
-rw-r--r--src/audio_core/renderer/performance/performance_frame_header.h4
-rw-r--r--src/audio_core/renderer/performance/performance_manager.cpp4
-rw-r--r--src/audio_core/renderer/performance/performance_manager.h4
-rw-r--r--src/audio_core/renderer/sink/circular_buffer_sink_info.cpp4
-rw-r--r--src/audio_core/renderer/sink/circular_buffer_sink_info.h4
-rw-r--r--src/audio_core/renderer/sink/device_sink_info.cpp4
-rw-r--r--src/audio_core/renderer/sink/device_sink_info.h4
-rw-r--r--src/audio_core/renderer/sink/sink_context.cpp4
-rw-r--r--src/audio_core/renderer/sink/sink_context.h4
-rw-r--r--src/audio_core/renderer/sink/sink_info_base.cpp4
-rw-r--r--src/audio_core/renderer/sink/sink_info_base.h4
-rw-r--r--src/audio_core/renderer/splitter/splitter_context.cpp4
-rw-r--r--src/audio_core/renderer/splitter/splitter_context.h4
-rw-r--r--src/audio_core/renderer/splitter/splitter_destinations_data.cpp4
-rw-r--r--src/audio_core/renderer/splitter/splitter_destinations_data.h4
-rw-r--r--src/audio_core/renderer/splitter/splitter_info.cpp4
-rw-r--r--src/audio_core/renderer/splitter/splitter_info.h4
-rw-r--r--src/audio_core/renderer/system.cpp42
-rw-r--r--src/audio_core/renderer/system.h16
-rw-r--r--src/audio_core/renderer/system_manager.cpp30
-rw-r--r--src/audio_core/renderer/system_manager.h21
-rw-r--r--src/audio_core/renderer/upsampler/upsampler_info.h4
-rw-r--r--src/audio_core/renderer/upsampler/upsampler_manager.cpp4
-rw-r--r--src/audio_core/renderer/upsampler/upsampler_manager.h4
-rw-r--r--src/audio_core/renderer/upsampler/upsampler_state.h4
-rw-r--r--src/audio_core/renderer/voice/voice_channel_resource.h4
-rw-r--r--src/audio_core/renderer/voice/voice_context.cpp4
-rw-r--r--src/audio_core/renderer/voice/voice_context.h4
-rw-r--r--src/audio_core/renderer/voice/voice_info.cpp4
-rw-r--r--src/audio_core/renderer/voice/voice_info.h4
-rw-r--r--src/audio_core/renderer/voice/voice_state.h4
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/core/crypto/key_manager.cpp226
-rw-r--r--src/core/crypto/key_manager.h59
-rw-r--r--src/core/file_sys/submission_package.cpp35
-rw-r--r--src/core/file_sys/submission_package.h1
-rw-r--r--src/core/hle/kernel/k_capabilities.cpp1
-rw-r--r--src/core/hle/service/am/applets/applet_mii_edit.cpp2
-rw-r--r--src/core/hle/service/audio/audin_u.cpp4
-rw-r--r--src/core/hle/service/audio/audout_u.cpp2
-rw-r--r--src/core/hle/service/audio/audren_u.cpp2
-rw-r--r--src/core/hle/service/audio/audren_u.h2
-rw-r--r--src/core/hle/service/es/es.cpp10
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp14
-rw-r--r--src/core/hle/service/mii/mii_manager.h1
-rw-r--r--src/core/hle/service/mii/raw_data.cpp5
-rw-r--r--src/core/hle/service/mii/raw_data.h3
-rw-r--r--src/core/hle/service/nfc/common/device.cpp4
-rw-r--r--src/core/hle/service/nvdrv/core/nvmap.cpp4
-rw-r--r--src/core/hle/service/ssl/ssl_backend_schannel.cpp3
-rw-r--r--src/core/loader/loader.cpp4
-rw-r--r--src/core/loader/loader.h10
-rw-r--r--src/core/loader/nca.cpp76
-rw-r--r--src/core/loader/nca.h2
-rw-r--r--src/core/loader/nsp.cpp36
-rw-r--r--src/core/loader/nsp.h2
-rw-r--r--src/core/loader/xci.cpp34
-rw-r--r--src/core/loader/xci.h2
-rw-r--r--src/dedicated_room/yuzu_room.cpp6
-rw-r--r--src/input_common/CMakeLists.txt2
-rw-r--r--src/network/room.cpp2
-rw-r--r--src/shader_recompiler/CMakeLists.txt2
-rw-r--r--src/shader_recompiler/backend/spirv/spirv_emit_context.cpp7
-rw-r--r--src/tests/common/ring_buffer.cpp2
-rw-r--r--src/video_core/renderer_vulkan/renderer_vulkan.cpp18
-rw-r--r--src/video_core/renderer_vulkan/renderer_vulkan.h4
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.cpp11
-rw-r--r--src/video_core/vulkan_common/vulkan_debug_callback.cpp27
-rw-r--r--src/video_core/vulkan_common/vulkan_debug_callback.h2
-rw-r--r--src/video_core/vulkan_common/vulkan_instance.cpp8
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp28
-rw-r--r--src/yuzu/configuration/shared_widget.cpp2
-rw-r--r--src/yuzu/game_list.cpp3
-rw-r--r--src/yuzu/game_list.h1
-rw-r--r--src/yuzu/main.cpp137
-rw-r--r--src/yuzu/main.h1
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
219 files changed, 1813 insertions, 1727 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b39b295f..3b0891adf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,6 +49,8 @@ option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
+option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)
+
CMAKE_DEPENDENT_OPTION(YUZU_ROOM "Compile LDN room server" ON "NOT ANDROID" OFF)
CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF)
@@ -79,6 +81,24 @@ if (ANDROID OR WIN32 OR APPLE)
endif()
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})
+if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL)
+ set(vvl_version "sdk-1.3.261.1")
+ set(vvl_zip_file "${CMAKE_BINARY_DIR}/externals/vvl-android.zip")
+ if (NOT EXISTS "${vvl_zip_file}")
+ # Download and extract validation layer release to externals directory
+ set(vvl_base_url "https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download")
+ file(DOWNLOAD "${vvl_base_url}/${vvl_version}/android-binaries-${vvl_version}-android.zip"
+ "${vvl_zip_file}" SHOW_PROGRESS)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${vvl_zip_file}"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
+ endif()
+
+ # Copy the arm64 binary to src/android/app/main/jniLibs
+ set(vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/arm64-v8a/")
+ file(COPY "${CMAKE_BINARY_DIR}/externals/android-binaries-${vvl_version}/arm64-v8a/libVkLayer_khronos_validation.so"
+ DESTINATION "${vvl_lib_path}")
+endif()
+
# On Android, fetch and compile libcxx before doing anything else
if (ANDROID)
set(CMAKE_SKIP_INSTALL_RULES ON)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9f68a8f2..d7f68618c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,7 +24,7 @@ if (MSVC)
# Ensure that projects build with Unicode support.
add_definitions(-DUNICODE -D_UNICODE)
- # /W3 - Level 3 warnings
+ # /W4 - Level 4 warnings
# /MP - Multi-threaded compilation
# /Zi - Output debugging information
# /Zm - Specifies the precompiled header memory allocation limit
@@ -61,7 +61,7 @@ if (MSVC)
/external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers
# Warnings
- /W3
+ /W4
/WX
/we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled
@@ -84,12 +84,17 @@ if (MSVC)
/wd4100 # 'identifier': unreferenced formal parameter
/wd4324 # 'struct_name': structure was padded due to __declspec(align())
+ /wd4201 # nonstandard extension used : nameless struct/union
+ /wd4702 # unreachable code (when used with LTO)
)
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
add_compile_options(/Z7)
+ # Avoid D9025 warning
+ string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
else()
add_compile_options(/Zi)
endif()
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index e7b595459..67dfe0290 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -2,6 +2,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later
add_library(audio_core STATIC
+ adsp/adsp.cpp
+ adsp/adsp.h
+ adsp/mailbox.h
+ adsp/apps/audio_renderer/audio_renderer.cpp
+ adsp/apps/audio_renderer/audio_renderer.h
+ adsp/apps/audio_renderer/command_buffer.h
+ adsp/apps/audio_renderer/command_list_processor.cpp
+ adsp/apps/audio_renderer/command_list_processor.h
audio_core.cpp
audio_core.h
audio_event.h
@@ -32,13 +40,6 @@ add_library(audio_core STATIC
out/audio_out_system.cpp
out/audio_out_system.h
precompiled_headers.h
- renderer/adsp/adsp.cpp
- renderer/adsp/adsp.h
- renderer/adsp/audio_renderer.cpp
- renderer/adsp/audio_renderer.h
- renderer/adsp/command_buffer.h
- renderer/adsp/command_list_processor.cpp
- renderer/adsp/command_list_processor.h
renderer/audio_device.cpp
renderer/audio_device.h
renderer/audio_renderer.h
diff --git a/src/audio_core/adsp/adsp.cpp b/src/audio_core/adsp/adsp.cpp
new file mode 100644
index 000000000..0580990f5
--- /dev/null
+++ b/src/audio_core/adsp/adsp.cpp
@@ -0,0 +1,18 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "audio_core/adsp/adsp.h"
+#include "core/core.h"
+
+namespace AudioCore::ADSP {
+
+ADSP::ADSP(Core::System& system, Sink::Sink& sink) {
+ audio_renderer =
+ std::make_unique<AudioRenderer::AudioRenderer>(system, system.ApplicationMemory(), sink);
+}
+
+AudioRenderer::AudioRenderer& ADSP::AudioRenderer() {
+ return *audio_renderer.get();
+}
+
+} // namespace AudioCore::ADSP
diff --git a/src/audio_core/adsp/adsp.h b/src/audio_core/adsp/adsp.h
new file mode 100644
index 000000000..bd5bcc63b
--- /dev/null
+++ b/src/audio_core/adsp/adsp.h
@@ -0,0 +1,50 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "audio_core/adsp/apps/audio_renderer/audio_renderer.h"
+#include "common/common_types.h"
+
+namespace Core {
+class System;
+} // namespace Core
+
+namespace AudioCore {
+namespace Sink {
+class Sink;
+}
+
+namespace ADSP {
+
+/**
+ * Represents the ADSP embedded within the audio sysmodule.
+ * This is a 32-bit Linux4Tegra kernel from nVidia, which is launched with the sysmodule on boot.
+ *
+ * The kernel will run the apps you write for it, Nintendo have the following:
+ *
+ * Gmix - Responsible for mixing final audio and sending it out to hardware. This is last place all
+ * audio samples end up, and we skip it entirely, since we have very different backends and
+ * mixing is implicitly handled by the OS (but also due to lack of research/simplicity).
+ *
+ * AudioRenderer - Receives command lists generated by the audio render
+ * system on the host, processes them, and sends the samples to Gmix.
+ *
+ * OpusDecoder - Contains libopus, and decodes Opus audio packets into raw pcm data.
+ *
+ * Communication between the host and ADSP is done through mailboxes, and mapping of shared memory.
+ */
+class ADSP {
+public:
+ explicit ADSP(Core::System& system, Sink::Sink& sink);
+ ~ADSP() = default;
+
+ AudioRenderer::AudioRenderer& AudioRenderer();
+
+private:
+ /// AudioRenderer app
+ std::unique_ptr<AudioRenderer::AudioRenderer> audio_renderer{};
+};
+
+} // namespace ADSP
+} // namespace AudioCore
diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp
new file mode 100644
index 000000000..2e549bc6f
--- /dev/null
+++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp
@@ -0,0 +1,220 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <array>
+#include <chrono>
+
+#include "audio_core/adsp/apps/audio_renderer/audio_renderer.h"
+#include "audio_core/audio_core.h"
+#include "audio_core/common/common.h"
+#include "audio_core/sink/sink.h"
+#include "common/logging/log.h"
+#include "common/microprofile.h"
+#include "common/thread.h"
+#include "core/core.h"
+#include "core/core_timing.h"
+
+MICROPROFILE_DEFINE(Audio_Renderer, "Audio", "DSP", MP_RGB(60, 19, 97));
+
+namespace AudioCore::ADSP::AudioRenderer {
+
+AudioRenderer::AudioRenderer(Core::System& system_, Core::Memory::Memory& memory_,
+ Sink::Sink& sink_)
+ : system{system_}, memory{memory_}, sink{sink_} {}
+
+AudioRenderer::~AudioRenderer() {
+ Stop();
+}
+
+void AudioRenderer::Start() {
+ CreateSinkStreams();
+
+ mailbox.Initialize(AppMailboxId::AudioRenderer);
+
+ main_thread = std::jthread([this](std::stop_token stop_token) { Main(stop_token); });
+
+ mailbox.Send(Direction::DSP, {Message::InitializeOK, {}});
+ if (mailbox.Receive(Direction::Host).msg != Message::InitializeOK) {
+ LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown "
+ "message response from ADSP!");
+ return;
+ }
+ running = true;
+}
+
+void AudioRenderer::Stop() {
+ if (!running) {
+ return;
+ }
+
+ mailbox.Send(Direction::DSP, {Message::Shutdown, {}});
+ if (mailbox.Receive(Direction::Host).msg != Message::Shutdown) {
+ LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown "
+ "message response from ADSP!");
+ }
+ main_thread.request_stop();
+ main_thread.join();
+
+ for (auto& stream : streams) {
+ if (stream) {
+ stream->Stop();
+ sink.CloseStream(stream);
+ stream = nullptr;
+ }
+ }
+ running = false;
+}
+
+void AudioRenderer::Signal() {
+ signalled_tick = system.CoreTiming().GetGlobalTimeNs().count();
+ Send(Direction::DSP, {Message::Render, {}});
+}
+
+void AudioRenderer::Wait() {
+ auto received = Receive(Direction::Host);
+ if (received.msg != Message::RenderResponse) {
+ LOG_ERROR(Service_Audio,
+ "Did not receive the expected render response from the AudioRenderer! Expected "
+ "{}, got {}",
+ Message::RenderResponse, received.msg);
+ }
+}
+
+void AudioRenderer::Send(Direction dir, MailboxMessage message) {
+ mailbox.Send(dir, std::move(message));
+}
+
+MailboxMessage AudioRenderer::Receive(Direction dir, bool block) {
+ return mailbox.Receive(dir, block);
+}
+
+void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
+ u64 applet_resource_user_id, bool reset) noexcept {
+ command_buffers[session_id].buffer = buffer;
+ command_buffers[session_id].size = size;
+ command_buffers[session_id].time_limit = time_limit;
+ command_buffers[session_id].applet_resource_user_id = applet_resource_user_id;
+ command_buffers[session_id].reset_buffer = reset;
+}
+
+u32 AudioRenderer::GetRemainCommandCount(s32 session_id) const noexcept {
+ return command_buffers[session_id].remaining_command_count;
+}
+
+void AudioRenderer::ClearRemainCommandCount(s32 session_id) noexcept {
+ command_buffers[session_id].remaining_command_count = 0;
+}
+
+u64 AudioRenderer::GetRenderingStartTick(s32 session_id) const noexcept {
+ return (1000 * command_buffers[session_id].render_time_taken_us) + signalled_tick;
+}
+
+void AudioRenderer::CreateSinkStreams() {
+ u32 channels{sink.GetDeviceChannels()};
+ for (u32 i = 0; i < MaxRendererSessions; i++) {
+ std::string name{fmt::format("ADSP_RenderStream-{}", i)};
+ streams[i] =
+ sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render);
+ streams[i]->SetRingSize(4);
+ }
+}
+
+void AudioRenderer::Main(std::stop_token stop_token) {
+ static constexpr char name[]{"AudioRenderer"};
+ MicroProfileOnThreadCreate(name);
+ Common::SetCurrentThreadName(name);
+ Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
+
+ // TODO: Create buffer map/unmap thread + mailbox
+ // TODO: Create gMix devices, initialize them here
+
+ if (mailbox.Receive(Direction::DSP).msg != Message::InitializeOK) {
+ LOG_ERROR(Service_Audio,
+ "ADSP Audio Renderer -- Failed to receive initialize message from host!");
+ return;
+ }
+
+ mailbox.Send(Direction::Host, {Message::InitializeOK, {}});
+
+ // 0.12 seconds (2,304,000 / 19,200,000)
+ constexpr u64 max_process_time{2'304'000ULL};
+
+ while (!stop_token.stop_requested()) {
+ auto received{mailbox.Receive(Direction::DSP)};
+ switch (received.msg) {
+ case Message::Shutdown:
+ mailbox.Send(Direction::Host, {Message::Shutdown, {}});
+ return;
+
+ case Message::Render: {
+ if (system.IsShuttingDown()) [[unlikely]] {
+ std::this_thread::sleep_for(std::chrono::milliseconds(5));
+ mailbox.Send(Direction::Host, {Message::RenderResponse, {}});
+ continue;
+ }
+ std::array<bool, MaxRendererSessions> buffers_reset{};
+ std::array<u64, MaxRendererSessions> render_times_taken{};
+ const auto start_time{system.CoreTiming().GetGlobalTimeUs().count()};
+
+ for (u32 index = 0; index < MaxRendererSessions; index++) {
+ auto& command_buffer{command_buffers[index]};
+ auto& command_list_processor{command_list_processors[index]};
+
+ // Check this buffer is valid, as it may not be used.
+ if (command_buffer.buffer != 0) {
+ // If there are no remaining commands (from the previous list),
+ // this is a new command list, initialize it.
+ if (command_buffer.remaining_command_count == 0) {
+ command_list_processor.Initialize(system, command_buffer.buffer,
+ command_buffer.size, streams[index]);
+ }
+
+ if (command_buffer.reset_buffer && !buffers_reset[index]) {
+ streams[index]->ClearQueue();
+ buffers_reset[index] = true;
+ }
+
+ u64 max_time{max_process_time};
+ if (index == 1 && command_buffer.applet_resource_user_id ==
+ command_buffers[0].applet_resource_user_id) {
+ max_time = max_process_time - render_times_taken[0];
+ if (render_times_taken[0] > max_process_time) {
+ max_time = 0;
+ }
+ }
+
+ max_time = std::min(command_buffer.time_limit, max_time);
+ command_list_processor.SetProcessTimeMax(max_time);
+
+ if (index == 0) {
+ streams[index]->WaitFreeSpace(stop_token);
+ }
+
+ // Process the command list
+ {
+ MICROPROFILE_SCOPE(Audio_Renderer);
+ render_times_taken[index] =
+ command_list_processor.Process(index) - start_time;
+ }
+
+ const auto end_time{system.CoreTiming().GetGlobalTimeUs().count()};
+
+ command_buffer.remaining_command_count =
+ command_list_processor.GetRemainingCommandCount();
+ command_buffer.render_time_taken_us = end_time - start_time;
+ }
+ }
+
+ mailbox.Send(Direction::Host, {Message::RenderResponse, {}});
+ } break;
+
+ default:
+ LOG_WARNING(Service_Audio,
+ "ADSP AudioRenderer received an invalid message, msg={:02X}!",
+ received.msg);
+ break;
+ }
+ }
+}
+
+} // namespace AudioCore::ADSP::AudioRenderer
diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h
new file mode 100644
index 000000000..3f5b7dca2
--- /dev/null
+++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h
@@ -0,0 +1,116 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <array>
+#include <memory>
+#include <thread>
+
+#include "audio_core/adsp/apps/audio_renderer/command_buffer.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
+#include "audio_core/adsp/mailbox.h"
+#include "common/common_types.h"
+#include "common/polyfill_thread.h"
+#include "common/reader_writer_queue.h"
+#include "common/thread.h"
+
+namespace Core {
+class System;
+namespace Timing {
+struct EventType;
+}
+namespace Memory {
+class Memory;
+}
+class System;
+} // namespace Core
+
+namespace AudioCore {
+namespace Sink {
+class Sink;
+}
+
+namespace ADSP::AudioRenderer {
+
+enum Message : u32 {
+ Invalid = 0x00,
+ MapUnmap_Map = 0x01,
+ MapUnmap_MapResponse = 0x02,
+ MapUnmap_Unmap = 0x03,
+ MapUnmap_UnmapResponse = 0x04,
+ MapUnmap_InvalidateCache = 0x05,
+ MapUnmap_InvalidateCacheResponse = 0x06,
+ MapUnmap_Shutdown = 0x07,
+ MapUnmap_ShutdownResponse = 0x08,
+ InitializeOK = 0x16,
+ RenderResponse = 0x20,
+ Render = 0x2A,
+ Shutdown = 0x34,
+};
+
+/**
+ * The AudioRenderer application running on the ADSP.
+ */
+class AudioRenderer {
+public:
+ explicit AudioRenderer(Core::System& system, Core::Memory::Memory& memory, Sink::Sink& sink);
+ ~AudioRenderer();
+
+ /**
+ * Start the AudioRenderer.
+ *
+ * @param mailbox The mailbox to use for this session.
+ */
+ void Start();
+
+ /**
+ * Stop the AudioRenderer.
+ */
+ void Stop();
+
+ void Signal();
+ void Wait();
+
+ void Send(Direction dir, MailboxMessage message);
+ MailboxMessage Receive(Direction dir, bool block = true);
+
+ void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
+ u64 applet_resource_user_id, bool reset) noexcept;
+ u32 GetRemainCommandCount(s32 session_id) const noexcept;
+ void ClearRemainCommandCount(s32 session_id) noexcept;
+ u64 GetRenderingStartTick(s32 session_id) const noexcept;
+
+private:
+ /**
+ * Main AudioRenderer thread, responsible for processing the command lists.
+ */
+ void Main(std::stop_token stop_token);
+
+ /**
+ * Creates the streams which will receive the processed samples.
+ */
+ void CreateSinkStreams();
+
+ /// Core system
+ Core::System& system;
+ /// Memory
+ Core::Memory::Memory& memory;
+ /// The output sink the AudioRenderer will use
+ Sink::Sink& sink;
+ /// The active mailbox
+ Mailbox mailbox;
+ /// Main thread
+ std::jthread main_thread{};
+ /// The current state
+ std::atomic<bool> running{};
+ std::array<CommandBuffer, MaxRendererSessions> command_buffers{};
+ /// The command lists to process
+ std::array<CommandListProcessor, MaxRendererSessions> command_list_processors{};
+ /// The streams which will receive the processed samples
+ std::array<Sink::SinkStream*, MaxRendererSessions> streams{};
+ u64 signalled_tick{0};
+};
+
+} // namespace ADSP::AudioRenderer
+} // namespace AudioCore
diff --git a/src/audio_core/adsp/apps/audio_renderer/command_buffer.h b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h
new file mode 100644
index 000000000..3fd1b09dc
--- /dev/null
+++ b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h
@@ -0,0 +1,23 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "audio_core/common/common.h"
+#include "common/common_types.h"
+
+namespace AudioCore::ADSP::AudioRenderer {
+
+struct CommandBuffer {
+ // Set by the host
+ CpuAddr buffer{};
+ u64 size{};
+ u64 time_limit{};
+ u64 applet_resource_user_id{};
+ bool reset_buffer{};
+ // Set by the DSP
+ u32 remaining_command_count{};
+ u64 render_time_taken_us{};
+};
+
+} // namespace AudioCore::ADSP::AudioRenderer
diff --git a/src/audio_core/renderer/adsp/command_list_processor.cpp b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp
index 3a0f1ae38..24e4d0496 100644
--- a/src/audio_core/renderer/adsp/command_list_processor.cpp
+++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp
@@ -1,9 +1,9 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <string>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/command_list_header.h"
#include "audio_core/renderer/command/commands.h"
#include "common/settings.h"
@@ -11,15 +11,15 @@
#include "core/core_timing.h"
#include "core/memory.h"
-namespace AudioCore::AudioRenderer::ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size,
Sink::SinkStream* stream_) {
system = &system_;
memory = &system->ApplicationMemory();
stream = stream_;
- header = reinterpret_cast<CommandListHeader*>(buffer);
- commands = reinterpret_cast<u8*>(buffer + sizeof(CommandListHeader));
+ header = reinterpret_cast<Renderer::CommandListHeader*>(buffer);
+ commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader));
commands_buffer_size = size;
command_count = header->command_count;
sample_count = header->sample_count;
@@ -37,17 +37,12 @@ u32 CommandListProcessor::GetRemainingCommandCount() const {
return command_count - processed_command_count;
}
-void CommandListProcessor::SetBuffer(const CpuAddr buffer, const u64 size) {
- commands = reinterpret_cast<u8*>(buffer + sizeof(CommandListHeader));
- commands_buffer_size = size;
-}
-
Sink::SinkStream* CommandListProcessor::GetOutputSinkStream() const {
return stream;
}
u64 CommandListProcessor::Process(u32 session_id) {
- const auto start_time_{system->CoreTiming().GetClockTicks()};
+ const auto start_time_{system->CoreTiming().GetGlobalTimeUs().count()};
const auto command_base{CpuAddr(commands)};
if (processed_command_count > 0) {
@@ -60,12 +55,12 @@ u64 CommandListProcessor::Process(u32 session_id) {
std::string dump{fmt::format("\nSession {}\n", session_id)};
for (u32 index = 0; index < command_count; index++) {
- auto& command{*reinterpret_cast<ICommand*>(commands)};
+ auto& command{*reinterpret_cast<Renderer::ICommand*>(commands)};
if (command.magic != 0xCAFEBABE) {
LOG_ERROR(Service_Audio, "Command has invalid magic! Expected 0xCAFEBABE, got {:08X}",
command.magic);
- return system->CoreTiming().GetClockTicks() - start_time_;
+ return system->CoreTiming().GetGlobalTimeUs().count() - start_time_;
}
auto current_offset{CpuAddr(commands) - command_base};
@@ -74,8 +69,8 @@ u64 CommandListProcessor::Process(u32 session_id) {
LOG_ERROR(Service_Audio,
"Command exceeded command buffer, buffer size {:08X}, command ends at {:08X}",
commands_buffer_size,
- CpuAddr(commands) + command.size - sizeof(CommandListHeader));
- return system->CoreTiming().GetClockTicks() - start_time_;
+ CpuAddr(commands) + command.size - sizeof(Renderer::CommandListHeader));
+ return system->CoreTiming().GetGlobalTimeUs().count() - start_time_;
}
if (Settings::values.dump_audio_commands) {
@@ -101,8 +96,8 @@ u64 CommandListProcessor::Process(u32 session_id) {
last_dump = dump;
}
- end_time = system->CoreTiming().GetClockTicks();
+ end_time = system->CoreTiming().GetGlobalTimeUs().count();
return end_time - start_time_;
}
-} // namespace AudioCore::AudioRenderer::ADSP
+} // namespace AudioCore::ADSP::AudioRenderer
diff --git a/src/audio_core/renderer/adsp/command_list_processor.h b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h
index d78269e1d..4e5fb793e 100644
--- a/src/audio_core/renderer/adsp/command_list_processor.h
+++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@@ -6,6 +6,7 @@
#include <span>
#include "audio_core/common/common.h"
+#include "audio_core/renderer/command/command_list_header.h"
#include "common/common_types.h"
namespace Core {
@@ -20,10 +21,11 @@ namespace Sink {
class SinkStream;
}
-namespace AudioRenderer {
+namespace Renderer {
struct CommandListHeader;
+}
-namespace ADSP {
+namespace ADSP::AudioRenderer {
/**
* A processor for command lists given to the AudioRenderer.
@@ -55,14 +57,6 @@ public:
u32 GetRemainingCommandCount() const;
/**
- * Set the command buffer.
- *
- * @param buffer - The buffer to use.
- * @param size - The size of the buffer.
- */
- void SetBuffer(CpuAddr buffer, u64 size);
-
- /**
* Get the stream for this command list.
*
* @return The stream associated with this command list.
@@ -85,7 +79,7 @@ public:
/// Stream for the processed samples
Sink::SinkStream* stream{};
/// Header info for this command list
- CommandListHeader* header{};
+ Renderer::CommandListHeader* header{};
/// The command buffer
u8* commands{};
/// The command buffer size
@@ -114,6 +108,5 @@ public:
std::string last_dump{};
};
-} // namespace ADSP
-} // namespace AudioRenderer
+} // namespace ADSP::AudioRenderer
} // namespace AudioCore
diff --git a/src/audio_core/adsp/mailbox.h b/src/audio_core/adsp/mailbox.h
new file mode 100644
index 000000000..c31b73717
--- /dev/null
+++ b/src/audio_core/adsp/mailbox.h
@@ -0,0 +1,69 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "common/bounded_threadsafe_queue.h"
+#include "common/common_types.h"
+
+namespace AudioCore::ADSP {
+
+enum class AppMailboxId : u32 {
+ Invalid = 0,
+ AudioRenderer = 50,
+ AudioRendererMemoryMapUnmap = 51,
+};
+
+enum class Direction : u32 {
+ Host,
+ DSP,
+};
+
+struct MailboxMessage {
+ u32 msg;
+ std::span<u8> data;
+};
+
+class Mailbox {
+public:
+ void Initialize(AppMailboxId id_) {
+ Reset();
+ id = id_;
+ }
+
+ AppMailboxId Id() const noexcept {
+ return id;
+ }
+
+ void Send(Direction dir, MailboxMessage&& message) {
+ auto& queue = dir == Direction::Host ? host_queue : adsp_queue;
+ queue.EmplaceWait(std::move(message));
+ }
+
+ MailboxMessage Receive(Direction dir, bool block = true) {
+ auto& queue = dir == Direction::Host ? host_queue : adsp_queue;
+ MailboxMessage t;
+ if (block) {
+ queue.PopWait(t);
+ } else {
+ queue.TryPop(t);
+ }
+ return t;
+ }
+
+ void Reset() {
+ id = AppMailboxId::Invalid;
+ MailboxMessage t;
+ while (host_queue.TryPop(t)) {
+ }
+ while (adsp_queue.TryPop(t)) {
+ }
+ }
+
+private:
+ AppMailboxId id{0};
+ Common::SPSCQueue<MailboxMessage> host_queue;
+ Common::SPSCQueue<MailboxMessage> adsp_queue;
+};
+
+} // namespace AudioCore::ADSP
diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp
index 703ef4494..fcaab2b32 100644
--- a/src/audio_core/audio_core.cpp
+++ b/src/audio_core/audio_core.cpp
@@ -11,7 +11,7 @@ namespace AudioCore {
AudioCore::AudioCore(Core::System& system) : audio_manager{std::make_unique<AudioManager>()} {
CreateSinks();
// Must be created after the sinks
- adsp = std::make_unique<AudioRenderer::ADSP::ADSP>(system, *output_sink);
+ adsp = std::make_unique<ADSP::ADSP>(system, *output_sink);
}
AudioCore ::~AudioCore() {
@@ -43,7 +43,7 @@ Sink::Sink& AudioCore::GetInputSink() {
return *input_sink;
}
-AudioRenderer::ADSP::ADSP& AudioCore::GetADSP() {
+ADSP::ADSP& AudioCore::ADSP() {
return *adsp;
}
diff --git a/src/audio_core/audio_core.h b/src/audio_core/audio_core.h
index ea047773e..e4e27fc66 100644
--- a/src/audio_core/audio_core.h
+++ b/src/audio_core/audio_core.h
@@ -5,8 +5,8 @@
#include <memory>
+#include "audio_core/adsp/adsp.h"
#include "audio_core/audio_manager.h"
-#include "audio_core/renderer/adsp/adsp.h"
#include "audio_core/sink/sink.h"
namespace Core {
@@ -55,7 +55,7 @@ public:
*
* @return Ref to the ADSP.
*/
- AudioRenderer::ADSP::ADSP& GetADSP();
+ ADSP::ADSP& ADSP();
private:
/**
@@ -70,7 +70,7 @@ private:
/// Sink used for audio input
std::unique_ptr<Sink::Sink> input_sink;
/// The ADSP in the sysmodule
- std::unique_ptr<AudioRenderer::ADSP::ADSP> adsp;
+ std::unique_ptr<ADSP::ADSP> adsp;
};
} // namespace AudioCore
diff --git a/src/audio_core/audio_event.cpp b/src/audio_core/audio_event.cpp
index d15568e1f..c23ef0990 100644
--- a/src/audio_core/audio_event.cpp
+++ b/src/audio_core/audio_event.cpp
@@ -20,7 +20,6 @@ size_t Event::GetManagerIndex(const Type type) const {
default:
UNREACHABLE();
}
- return 3;
}
void Event::SetAudioEvent(const Type type, const bool signalled) {
diff --git a/src/audio_core/audio_in_manager.cpp b/src/audio_core/audio_in_manager.cpp
index 3dfb613cb..a3667524f 100644
--- a/src/audio_core/audio_in_manager.cpp
+++ b/src/audio_core/audio_in_manager.cpp
@@ -73,7 +73,7 @@ void Manager::BufferReleaseAndRegister() {
}
}
-u32 Manager::GetDeviceNames(std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names,
+u32 Manager::GetDeviceNames(std::vector<Renderer::AudioDevice::AudioDeviceName>& names,
[[maybe_unused]] const u32 max_count,
[[maybe_unused]] const bool filter) {
std::scoped_lock l{mutex};
diff --git a/src/audio_core/audio_in_manager.h b/src/audio_core/audio_in_manager.h
index 8a519df99..5c4614cd1 100644
--- a/src/audio_core/audio_in_manager.h
+++ b/src/audio_core/audio_in_manager.h
@@ -65,8 +65,8 @@ public:
*
* @return Number of names written.
*/
- u32 GetDeviceNames(std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names,
- u32 max_count, bool filter);
+ u32 GetDeviceNames(std::vector<Renderer::AudioDevice::AudioDeviceName>& names, u32 max_count,
+ bool filter);
/// Core system
Core::System& system;
diff --git a/src/audio_core/audio_out_manager.cpp b/src/audio_core/audio_out_manager.cpp
index f22821360..316ea7c81 100644
--- a/src/audio_core/audio_out_manager.cpp
+++ b/src/audio_core/audio_out_manager.cpp
@@ -73,7 +73,7 @@ void Manager::BufferReleaseAndRegister() {
}
u32 Manager::GetAudioOutDeviceNames(
- std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names) const {
+ std::vector<Renderer::AudioDevice::AudioDeviceName>& names) const {
names.emplace_back("DeviceOut");
return 1;
}
diff --git a/src/audio_core/audio_out_manager.h b/src/audio_core/audio_out_manager.h
index 1e05ec5ed..c3e445d5d 100644
--- a/src/audio_core/audio_out_manager.h
+++ b/src/audio_core/audio_out_manager.h
@@ -61,8 +61,7 @@ public:
* @param names - Output container to write names to.
* @return Number of names written.
*/
- u32 GetAudioOutDeviceNames(
- std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names) const;
+ u32 GetAudioOutDeviceNames(std::vector<Renderer::AudioDevice::AudioDeviceName>& names) const;
/// Core system
Core::System& system;
diff --git a/src/audio_core/audio_render_manager.cpp b/src/audio_core/audio_render_manager.cpp
index 320715727..3c53e3afd 100644
--- a/src/audio_core/audio_render_manager.cpp
+++ b/src/audio_core/audio_render_manager.cpp
@@ -6,7 +6,7 @@
#include "audio_core/common/feature_support.h"
#include "core/core.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
Manager::Manager(Core::System& system_)
: system{system_}, system_manager{std::make_unique<SystemManager>(system)} {
@@ -67,4 +67,4 @@ bool Manager::RemoveSystem(System& system_) {
return system_manager->Remove(system_);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/audio_render_manager.h b/src/audio_core/audio_render_manager.h
index fffa5944d..45537b270 100644
--- a/src/audio_core/audio_render_manager.h
+++ b/src/audio_core/audio_render_manager.h
@@ -20,7 +20,7 @@ class System;
namespace AudioCore {
struct AudioRendererParameterInternal;
-namespace AudioRenderer {
+namespace Renderer {
/**
* Wrapper for the audio system manager, handles service calls.
*/
@@ -101,5 +101,5 @@ private:
std::unique_ptr<SystemManager> system_manager{};
};
-} // namespace AudioRenderer
+} // namespace Renderer
} // namespace AudioCore
diff --git a/src/audio_core/common/audio_renderer_parameter.h b/src/audio_core/common/audio_renderer_parameter.h
index 8c7892bcf..6c4e9fdc6 100644
--- a/src/audio_core/common/audio_renderer_parameter.h
+++ b/src/audio_core/common/audio_renderer_parameter.h
@@ -51,10 +51,10 @@ struct AudioRendererSystemContext {
s32 session_id;
s8 channels;
s16 mix_buffer_count;
- AudioRenderer::BehaviorInfo* behavior;
+ Renderer::BehaviorInfo* behavior;
std::span<s32> depop_buffer;
- AudioRenderer::UpsamplerManager* upsampler_manager;
- AudioRenderer::MemoryPoolInfo* memory_pool_info;
+ Renderer::UpsamplerManager* upsampler_manager;
+ Renderer::MemoryPoolInfo* memory_pool_info;
};
} // namespace AudioCore
diff --git a/src/audio_core/renderer/adsp/adsp.cpp b/src/audio_core/renderer/adsp/adsp.cpp
deleted file mode 100644
index b1db31e93..000000000
--- a/src/audio_core/renderer/adsp/adsp.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "audio_core/renderer/adsp/adsp.h"
-#include "audio_core/renderer/adsp/command_buffer.h"
-#include "audio_core/sink/sink.h"
-#include "common/logging/log.h"
-#include "core/core.h"
-#include "core/core_timing.h"
-#include "core/memory.h"
-
-namespace AudioCore::AudioRenderer::ADSP {
-
-ADSP::ADSP(Core::System& system_, Sink::Sink& sink_)
- : system{system_}, memory{system.ApplicationMemory()}, sink{sink_} {}
-
-ADSP::~ADSP() {
- ClearCommandBuffers();
-}
-
-State ADSP::GetState() const {
- if (running) {
- return State::Started;
- }
- return State::Stopped;
-}
-
-AudioRenderer_Mailbox* ADSP::GetRenderMailbox() {
- return &render_mailbox;
-}
-
-void ADSP::ClearRemainCount(const u32 session_id) {
- render_mailbox.ClearRemainCount(session_id);
-}
-
-u64 ADSP::GetSignalledTick() const {
- return render_mailbox.GetSignalledTick();
-}
-
-u64 ADSP::GetTimeTaken() const {
- return render_mailbox.GetRenderTimeTaken();
-}
-
-u64 ADSP::GetRenderTimeTaken(const u32 session_id) {
- return render_mailbox.GetCommandBuffer(session_id).render_time_taken;
-}
-
-u32 ADSP::GetRemainCommandCount(const u32 session_id) const {
- return render_mailbox.GetRemainCommandCount(session_id);
-}
-
-void ADSP::SendCommandBuffer(const u32 session_id, const CommandBuffer& command_buffer) {
- render_mailbox.SetCommandBuffer(session_id, command_buffer);
-}
-
-u64 ADSP::GetRenderingStartTick(const u32 session_id) {
- return render_mailbox.GetSignalledTick() +
- render_mailbox.GetCommandBuffer(session_id).render_time_taken;
-}
-
-bool ADSP::Start() {
- if (running) {
- return running;
- }
-
- running = true;
- systems_active++;
- audio_renderer = std::make_unique<AudioRenderer>(system);
- audio_renderer->Start(&render_mailbox);
- render_mailbox.HostSendMessage(RenderMessage::AudioRenderer_InitializeOK);
- if (render_mailbox.HostWaitMessage() != RenderMessage::AudioRenderer_InitializeOK) {
- LOG_ERROR(
- Service_Audio,
- "Host Audio Renderer -- Failed to receive initialize message response from ADSP!");
- }
- return running;
-}
-
-void ADSP::Stop() {
- systems_active--;
- if (running && systems_active == 0) {
- {
- std::scoped_lock l{mailbox_lock};
- render_mailbox.HostSendMessage(RenderMessage::AudioRenderer_Shutdown);
- if (render_mailbox.HostWaitMessage() != RenderMessage::AudioRenderer_Shutdown) {
- LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown "
- "message response from ADSP!");
- }
- }
- audio_renderer->Stop();
- running = false;
- }
-}
-
-void ADSP::Signal() {
- const auto signalled_tick{system.CoreTiming().GetClockTicks()};
- render_mailbox.SetSignalledTick(signalled_tick);
- render_mailbox.HostSendMessage(RenderMessage::AudioRenderer_Render);
-}
-
-void ADSP::Wait() {
- std::scoped_lock l{mailbox_lock};
- auto response{render_mailbox.HostWaitMessage()};
- if (response != RenderMessage::AudioRenderer_RenderResponse) {
- LOG_ERROR(Service_Audio, "Invalid ADSP response message, expected 0x{:02X}, got 0x{:02X}",
- static_cast<u32>(RenderMessage::AudioRenderer_RenderResponse),
- static_cast<u32>(response));
- }
-
- ClearCommandBuffers();
-}
-
-void ADSP::ClearCommandBuffers() {
- render_mailbox.ClearCommandBuffers();
-}
-
-} // namespace AudioCore::AudioRenderer::ADSP
diff --git a/src/audio_core/renderer/adsp/adsp.h b/src/audio_core/renderer/adsp/adsp.h
deleted file mode 100644
index f7a2f25e4..000000000
--- a/src/audio_core/renderer/adsp/adsp.h
+++ /dev/null
@@ -1,171 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include <memory>
-#include <mutex>
-
-#include "audio_core/renderer/adsp/audio_renderer.h"
-#include "common/common_types.h"
-
-namespace Core {
-namespace Memory {
-class Memory;
-}
-class System;
-} // namespace Core
-
-namespace AudioCore {
-namespace Sink {
-class Sink;
-}
-
-namespace AudioRenderer::ADSP {
-struct CommandBuffer;
-
-enum class State {
- Started,
- Stopped,
-};
-
-/**
- * Represents the ADSP embedded within the audio sysmodule.
- * This is a 32-bit Linux4Tegra kernel from nVidia, which is launched with the sysmodule on boot.
- *
- * The kernel will run apps you program for it, Nintendo have the following:
- *
- * Gmix - Responsible for mixing final audio and sending it out to hardware. This is last place all
- * audio samples end up, and we skip it entirely, since we have very different backends and
- * mixing is implicitly handled by the OS (but also due to lack of research/simplicity).
- *
- * AudioRenderer - Receives command lists generated by the audio render
- * system, processes them, and sends the samples to Gmix.
- *
- * OpusDecoder - Contains libopus, and controls processing Opus audio and sends it to Gmix.
- * Not much research done here, TODO if needed.
- *
- * We only implement the AudioRenderer for now.
- *
- * Communication for the apps is done through mailboxes, and some shared memory.
- */
-class ADSP {
-public:
- explicit ADSP(Core::System& system, Sink::Sink& sink);
- ~ADSP();
-
- /**
- * Start the ADSP.
- *
- * @return True if started or already running, otherwise false.
- */
- bool Start();
-
- /**
- * Stop the ADSP.
- */
- void Stop();
-
- /**
- * Get the ADSP's state.
- *
- * @return Started or Stopped.
- */
- State GetState() const;
-
- /**
- * Get the AudioRenderer mailbox to communicate with it.
- *
- * @return The AudioRenderer mailbox.
- */
- AudioRenderer_Mailbox* GetRenderMailbox();
-
- /**
- * Get the tick the ADSP was signalled.
- *
- * @return The tick the ADSP was signalled.
- */
- u64 GetSignalledTick() const;
-
- /**
- * Get the total time it took for the ADSP to run the last command lists (both command lists).
- *
- * @return The tick the ADSP was signalled.
- */
- u64 GetTimeTaken() const;
-
- /**
- * Get the last time a given command list took to run.
- *
- * @param session_id - The session id to check (0 or 1).
- * @return The time it took.
- */
- u64 GetRenderTimeTaken(u32 session_id);
-
- /**
- * Clear the remaining command count for a given session.
- *
- * @param session_id - The session id to check (0 or 1).
- */
- void ClearRemainCount(u32 session_id);
-
- /**
- * Get the remaining number of commands left to process for a command list.
- *
- * @param session_id - The session id to check (0 or 1).
- * @return The number of commands remaining.
- */
- u32 GetRemainCommandCount(u32 session_id) const;
-
- /**
- * Get the last tick a command list started processing.
- *
- * @param session_id - The session id to check (0 or 1).
- * @return The last tick the given command list started.
- */
- u64 GetRenderingStartTick(u32 session_id);
-
- /**
- * Set a command buffer to be processed.
- *
- * @param session_id - The session id to check (0 or 1).
- * @param command_buffer - The command buffer to process.
- */
- void SendCommandBuffer(u32 session_id, const CommandBuffer& command_buffer);
-
- /**
- * Clear the command buffers (does not clear the time taken or the remaining command count)
- */
- void ClearCommandBuffers();
-
- /**
- * Signal the AudioRenderer to begin processing.
- */
- void Signal();
-
- /**
- * Wait for the AudioRenderer to finish processing.
- */
- void Wait();
-
-private:
- /// Core system
- Core::System& system;
- /// Core memory
- Core::Memory::Memory& memory;
- /// Number of systems active, used to prevent accidental shutdowns
- u8 systems_active{0};
- /// ADSP running state
- std::atomic<bool> running{false};
- /// Output sink used by the ADSP
- Sink::Sink& sink;
- /// AudioRenderer app
- std::unique_ptr<AudioRenderer> audio_renderer{};
- /// Communication for the AudioRenderer
- AudioRenderer_Mailbox render_mailbox{};
- /// Mailbox lock ffor the render mailbox
- std::mutex mailbox_lock;
-};
-
-} // namespace AudioRenderer::ADSP
-} // namespace AudioCore
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp
deleted file mode 100644
index 9ca716b60..000000000
--- a/src/audio_core/renderer/adsp/audio_renderer.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include <array>
-#include <chrono>
-
-#include "audio_core/audio_core.h"
-#include "audio_core/common/common.h"
-#include "audio_core/renderer/adsp/audio_renderer.h"
-#include "audio_core/sink/sink.h"
-#include "common/logging/log.h"
-#include "common/microprofile.h"
-#include "common/thread.h"
-#include "core/core.h"
-#include "core/core_timing.h"
-
-MICROPROFILE_DEFINE(Audio_Renderer, "Audio", "DSP", MP_RGB(60, 19, 97));
-
-namespace AudioCore::AudioRenderer::ADSP {
-
-void AudioRenderer_Mailbox::HostSendMessage(RenderMessage message_) {
- adsp_messages.enqueue(message_);
- adsp_event.Set();
-}
-
-RenderMessage AudioRenderer_Mailbox::HostWaitMessage() {
- host_event.Wait();
- RenderMessage msg{RenderMessage::Invalid};
- if (!host_messages.try_dequeue(msg)) {
- LOG_ERROR(Service_Audio, "Failed to dequeue host message!");
- }
- return msg;
-}
-
-void AudioRenderer_Mailbox::ADSPSendMessage(const RenderMessage message_) {
- host_messages.enqueue(message_);
- host_event.Set();
-}
-
-RenderMessage AudioRenderer_Mailbox::ADSPWaitMessage() {
- adsp_event.Wait();
- RenderMessage msg{RenderMessage::Invalid};
- if (!adsp_messages.try_dequeue(msg)) {
- LOG_ERROR(Service_Audio, "Failed to dequeue ADSP message!");
- }
- return msg;
-}
-
-CommandBuffer& AudioRenderer_Mailbox::GetCommandBuffer(const u32 session_id) {
- return command_buffers[session_id];
-}
-
-void AudioRenderer_Mailbox::SetCommandBuffer(const u32 session_id, const CommandBuffer& buffer) {
- command_buffers[session_id] = buffer;
-}
-
-u64 AudioRenderer_Mailbox::GetRenderTimeTaken() const {
- return command_buffers[0].render_time_taken + command_buffers[1].render_time_taken;
-}
-
-u64 AudioRenderer_Mailbox::GetSignalledTick() const {
- return signalled_tick;
-}
-
-void AudioRenderer_Mailbox::SetSignalledTick(const u64 tick) {
- signalled_tick = tick;
-}
-
-void AudioRenderer_Mailbox::ClearRemainCount(const u32 session_id) {
- command_buffers[session_id].remaining_command_count = 0;
-}
-
-u32 AudioRenderer_Mailbox::GetRemainCommandCount(const u32 session_id) const {
- return command_buffers[session_id].remaining_command_count;
-}
-
-void AudioRenderer_Mailbox::ClearCommandBuffers() {
- command_buffers[0].buffer = 0;
- command_buffers[0].size = 0;
- command_buffers[0].reset_buffers = false;
- command_buffers[1].buffer = 0;
- command_buffers[1].size = 0;
- command_buffers[1].reset_buffers = false;
-}
-
-AudioRenderer::AudioRenderer(Core::System& system_)
- : system{system_}, sink{system.AudioCore().GetOutputSink()} {
- CreateSinkStreams();
-}
-
-AudioRenderer::~AudioRenderer() {
- Stop();
- for (auto& stream : streams) {
- if (stream) {
- sink.CloseStream(stream);
- }
- stream = nullptr;
- }
-}
-
-void AudioRenderer::Start(AudioRenderer_Mailbox* mailbox_) {
- if (running) {
- return;
- }
-
- mailbox = mailbox_;
- thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); });
- running = true;
-}
-
-void AudioRenderer::Stop() {
- if (!running) {
- return;
- }
-
- for (auto& stream : streams) {
- stream->Stop();
- }
- thread.join();
- running = false;
-}
-
-void AudioRenderer::CreateSinkStreams() {
- u32 channels{sink.GetDeviceChannels()};
- for (u32 i = 0; i < MaxRendererSessions; i++) {
- std::string name{fmt::format("ADSP_RenderStream-{}", i)};
- streams[i] =
- sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render);
- streams[i]->SetRingSize(4);
- }
-}
-
-void AudioRenderer::ThreadFunc(std::stop_token stop_token) {
- static constexpr char name[]{"AudioRenderer"};
- MicroProfileOnThreadCreate(name);
- Common::SetCurrentThreadName(name);
- Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
- if (mailbox->ADSPWaitMessage() != RenderMessage::AudioRenderer_InitializeOK) {
- LOG_ERROR(Service_Audio,
- "ADSP Audio Renderer -- Failed to receive initialize message from host!");
- return;
- }
-
- mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK);
-
- // 0.12 seconds (2304000 / 19200000)
- constexpr u64 max_process_time{2'304'000ULL};
-
- while (!stop_token.stop_requested()) {
- auto message{mailbox->ADSPWaitMessage()};
- switch (message) {
- case RenderMessage::AudioRenderer_Shutdown:
- mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_Shutdown);
- return;
-
- case RenderMessage::AudioRenderer_Render: {
- if (system.IsShuttingDown()) [[unlikely]] {
- std::this_thread::sleep_for(std::chrono::milliseconds(5));
- mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_RenderResponse);
- continue;
- }
- std::array<bool, MaxRendererSessions> buffers_reset{};
- std::array<u64, MaxRendererSessions> render_times_taken{};
- const auto start_time{system.CoreTiming().GetClockTicks()};
-
- for (u32 index = 0; index < 2; index++) {
- auto& command_buffer{mailbox->GetCommandBuffer(index)};
- auto& command_list_processor{command_list_processors[index]};
-
- // Check this buffer is valid, as it may not be used.
- if (command_buffer.buffer != 0) {
- // If there are no remaining commands (from the previous list),
- // this is a new command list, initialize it.
- if (command_buffer.remaining_command_count == 0) {
- command_list_processor.Initialize(system, command_buffer.buffer,
- command_buffer.size, streams[index]);
- }
-
- if (command_buffer.reset_buffers && !buffers_reset[index]) {
- streams[index]->ClearQueue();
- buffers_reset[index] = true;
- }
-
- u64 max_time{max_process_time};
- if (index == 1 && command_buffer.applet_resource_user_id ==
- mailbox->GetCommandBuffer(0).applet_resource_user_id) {
- max_time = max_process_time - render_times_taken[0];
- if (render_times_taken[0] > max_process_time) {
- max_time = 0;
- }
- }
-
- max_time = std::min(command_buffer.time_limit, max_time);
- command_list_processor.SetProcessTimeMax(max_time);
-
- streams[index]->WaitFreeSpace(stop_token);
-
- // Process the command list
- {
- MICROPROFILE_SCOPE(Audio_Renderer);
- render_times_taken[index] =
- command_list_processor.Process(index) - start_time;
- }
-
- const auto end_time{system.CoreTiming().GetClockTicks()};
-
- command_buffer.remaining_command_count =
- command_list_processor.GetRemainingCommandCount();
- command_buffer.render_time_taken = end_time - start_time;
- }
- }
-
- mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_RenderResponse);
- } break;
-
- default:
- LOG_WARNING(Service_Audio,
- "ADSP AudioRenderer received an invalid message, msg={:02X}!",
- static_cast<u32>(message));
- break;
- }
- }
-}
-
-} // namespace AudioCore::AudioRenderer::ADSP
diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h
deleted file mode 100644
index 88e558183..000000000
--- a/src/audio_core/renderer/adsp/audio_renderer.h
+++ /dev/null
@@ -1,204 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include <array>
-#include <memory>
-#include <thread>
-
-#include "audio_core/renderer/adsp/command_buffer.h"
-#include "audio_core/renderer/adsp/command_list_processor.h"
-#include "common/common_types.h"
-#include "common/polyfill_thread.h"
-#include "common/reader_writer_queue.h"
-#include "common/thread.h"
-
-namespace Core {
-namespace Timing {
-struct EventType;
-}
-class System;
-} // namespace Core
-
-namespace AudioCore {
-namespace Sink {
-class Sink;
-}
-
-namespace AudioRenderer::ADSP {
-
-enum class RenderMessage {
- /* 0x00 */ Invalid,
- /* 0x01 */ AudioRenderer_MapUnmap_Map,
- /* 0x02 */ AudioRenderer_MapUnmap_MapResponse,
- /* 0x03 */ AudioRenderer_MapUnmap_Unmap,
- /* 0x04 */ AudioRenderer_MapUnmap_UnmapResponse,
- /* 0x05 */ AudioRenderer_MapUnmap_InvalidateCache,
- /* 0x06 */ AudioRenderer_MapUnmap_InvalidateCacheResponse,
- /* 0x07 */ AudioRenderer_MapUnmap_Shutdown,
- /* 0x08 */ AudioRenderer_MapUnmap_ShutdownResponse,
- /* 0x16 */ AudioRenderer_InitializeOK = 0x16,
- /* 0x20 */ AudioRenderer_RenderResponse = 0x20,
- /* 0x2A */ AudioRenderer_Render = 0x2A,
- /* 0x34 */ AudioRenderer_Shutdown = 0x34,
-};
-
-/**
- * A mailbox for the AudioRenderer, allowing communication between the host and the AudioRenderer
- * running on the ADSP.
- */
-class AudioRenderer_Mailbox {
-public:
- /**
- * Send a message from the host to the AudioRenderer.
- *
- * @param message - The message to send to the AudioRenderer.
- */
- void HostSendMessage(RenderMessage message);
-
- /**
- * Host wait for a message from the AudioRenderer.
- *
- * @return The message returned from the AudioRenderer.
- */
- RenderMessage HostWaitMessage();
-
- /**
- * Send a message from the AudioRenderer to the host.
- *
- * @param message - The message to send to the host.
- */
- void ADSPSendMessage(RenderMessage message);
-
- /**
- * AudioRenderer wait for a message from the host.
- *
- * @return The message returned from the AudioRenderer.
- */
- RenderMessage ADSPWaitMessage();
-
- /**
- * Get the command buffer with the given session id (0 or 1).
- *
- * @param session_id - The session id to get (0 or 1).
- * @return The command buffer.
- */
- CommandBuffer& GetCommandBuffer(u32 session_id);
-
- /**
- * Set the command buffer with the given session id (0 or 1).
- *
- * @param session_id - The session id to get (0 or 1).
- * @param buffer - The command buffer to set.
- */
- void SetCommandBuffer(u32 session_id, const CommandBuffer& buffer);
-
- /**
- * Get the total render time taken for the last command lists sent.
- *
- * @return Total render time taken for the last command lists.
- */
- u64 GetRenderTimeTaken() const;
-
- /**
- * Get the tick the AudioRenderer was signalled.
- *
- * @return The tick the AudioRenderer was signalled.
- */
- u64 GetSignalledTick() const;
-
- /**
- * Set the tick the AudioRenderer was signalled.
- *
- * @param tick - The tick the AudioRenderer was signalled.
- */
- void SetSignalledTick(u64 tick);
-
- /**
- * Clear the remaining command count.
- *
- * @param session_id - Index for which command list to clear (0 or 1).
- */
- void ClearRemainCount(u32 session_id);
-
- /**
- * Get the remaining command count for a given command list.
- *
- * @param session_id - Index for which command list to clear (0 or 1).
- * @return The remaining command count.
- */
- u32 GetRemainCommandCount(u32 session_id) const;
-
- /**
- * Clear the command buffers (does not clear the time taken or the remaining command count).
- */
- void ClearCommandBuffers();
-
-private:
- /// Host signalling event
- Common::Event host_event{};
- /// AudioRenderer signalling event
- Common::Event adsp_event{};
- /// Host message queue
-
- Common::ReaderWriterQueue<RenderMessage> host_messages{};
- /// AudioRenderer message queue
-
- Common::ReaderWriterQueue<RenderMessage> adsp_messages{};
- /// Command buffers
-
- std::array<CommandBuffer, MaxRendererSessions> command_buffers{};
- /// Tick the AudioRnederer was signalled
- u64 signalled_tick{};
-};
-
-/**
- * The AudioRenderer application running on the ADSP.
- */
-class AudioRenderer {
-public:
- explicit AudioRenderer(Core::System& system);
- ~AudioRenderer();
-
- /**
- * Start the AudioRenderer.
- *
- * @param mailbox The mailbox to use for this session.
- */
- void Start(AudioRenderer_Mailbox* mailbox);
-
- /**
- * Stop the AudioRenderer.
- */
- void Stop();
-
-private:
- /**
- * Main AudioRenderer thread, responsible for processing the command lists.
- */
- void ThreadFunc(std::stop_token stop_token);
-
- /**
- * Creates the streams which will receive the processed samples.
- */
- void CreateSinkStreams();
-
- /// Core system
- Core::System& system;
- /// Main thread
- std::jthread thread{};
- /// The current state
- std::atomic<bool> running{};
- /// The active mailbox
- AudioRenderer_Mailbox* mailbox{};
- /// The command lists to process
- std::array<CommandListProcessor, MaxRendererSessions> command_list_processors{};
- /// The output sink the AudioRenderer will use
- Sink::Sink& sink;
- /// The streams which will receive the processed samples
- std::array<Sink::SinkStream*, MaxRendererSessions> streams;
-};
-
-} // namespace AudioRenderer::ADSP
-} // namespace AudioCore
diff --git a/src/audio_core/renderer/adsp/command_buffer.h b/src/audio_core/renderer/adsp/command_buffer.h
deleted file mode 100644
index 880b279d8..000000000
--- a/src/audio_core/renderer/adsp/command_buffer.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "audio_core/common/common.h"
-#include "common/common_types.h"
-
-namespace AudioCore::AudioRenderer::ADSP {
-
-struct CommandBuffer {
- CpuAddr buffer;
- u64 size;
- u64 time_limit;
- u32 remaining_command_count;
- bool reset_buffers;
- u64 applet_resource_user_id;
- u64 render_time_taken;
-};
-
-} // namespace AudioCore::AudioRenderer::ADSP
diff --git a/src/audio_core/renderer/audio_device.cpp b/src/audio_core/renderer/audio_device.cpp
index 0d9d8f6ce..2d9bf82bb 100644
--- a/src/audio_core/renderer/audio_device.cpp
+++ b/src/audio_core/renderer/audio_device.cpp
@@ -10,7 +10,7 @@
#include "audio_core/sink/sink.h"
#include "core/core.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
constexpr std::array usb_device_names{
AudioDevice::AudioDeviceName{"AudioStereoJackOutput"},
@@ -71,4 +71,4 @@ f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) const {
return output_sink.GetDeviceVolume();
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/audio_device.h b/src/audio_core/renderer/audio_device.h
index dd6be70ee..ca4040add 100644
--- a/src/audio_core/renderer/audio_device.h
+++ b/src/audio_core/renderer/audio_device.h
@@ -16,7 +16,7 @@ namespace Sink {
class Sink;
}
-namespace AudioRenderer {
+namespace Renderer {
/**
* An interface to an output audio device available to the Switch.
*/
@@ -76,5 +76,5 @@ private:
const u32 user_revision;
};
-} // namespace AudioRenderer
+} // namespace Renderer
} // namespace AudioCore
diff --git a/src/audio_core/renderer/audio_renderer.cpp b/src/audio_core/renderer/audio_renderer.cpp
index a8257eb2e..09efe9be9 100644
--- a/src/audio_core/renderer/audio_renderer.cpp
+++ b/src/audio_core/renderer/audio_renderer.cpp
@@ -9,7 +9,7 @@
#include "core/hle/kernel/k_transfer_memory.h"
#include "core/hle/service/audio/errors.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* rendered_event)
: core{system_}, manager{manager_}, system{system_, rendered_event} {}
@@ -64,4 +64,4 @@ Result Renderer::RequestUpdate(std::span<const u8> input, std::span<u8> performa
return system.Update(input, performance, output);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/audio_renderer.h b/src/audio_core/renderer/audio_renderer.h
index 90c6f9727..24650278b 100644
--- a/src/audio_core/renderer/audio_renderer.h
+++ b/src/audio_core/renderer/audio_renderer.h
@@ -19,7 +19,7 @@ class KTransferMemory;
namespace AudioCore {
struct AudioRendererParameterInternal;
-namespace AudioRenderer {
+namespace Renderer {
class Manager;
/**
@@ -31,7 +31,7 @@ public:
/**
* Initialize the renderer.
- * Registers the system with the AudioRenderer::Manager, allocates workbuffers and initializes
+ * Registers the system with the Renderer::Manager, allocates workbuffers and initializes
* everything to a default state.
*
* @param params - Input parameters to initialize the system with.
@@ -93,5 +93,5 @@ private:
System system;
};
-} // namespace AudioRenderer
+} // namespace Renderer
} // namespace AudioCore
diff --git a/src/audio_core/renderer/behavior/behavior_info.cpp b/src/audio_core/renderer/behavior/behavior_info.cpp
index 3d2a91312..058539042 100644
--- a/src/audio_core/renderer/behavior/behavior_info.cpp
+++ b/src/audio_core/renderer/behavior/behavior_info.cpp
@@ -4,7 +4,7 @@
#include "audio_core/common/feature_support.h"
#include "audio_core/renderer/behavior/behavior_info.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
BehaviorInfo::BehaviorInfo() : process_revision{CurrentRevision} {}
@@ -190,4 +190,4 @@ bool BehaviorInfo::IsI3dl2ReverbChannelMappingChanged() const {
return CheckFeatureSupported(SupportTags::I3dl2ReverbChannelMappingChange, user_revision);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/behavior/behavior_info.h b/src/audio_core/renderer/behavior/behavior_info.h
index b52340229..a4958857a 100644
--- a/src/audio_core/renderer/behavior/behavior_info.h
+++ b/src/audio_core/renderer/behavior/behavior_info.h
@@ -10,7 +10,7 @@
#include "common/common_types.h"
#include "core/hle/service/audio/errors.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Holds host and user revisions, checks whether render features can be enabled, and reports errors.
*/
@@ -264,7 +264,7 @@ public:
/**
* Check if skipping voice pitch and sample rate conversion is supported.
* This speeds up the data source commands by skipping resampling if unwanted.
- * See AudioCore::AudioRenderer::DecodeFromWaveBuffers
+ * See AudioCore::Renderer::DecodeFromWaveBuffers
*
* @return True if supported, otherwise false.
*/
@@ -273,7 +273,7 @@ public:
/**
* Check if resetting played sample count at loop points is supported.
* This resets the number of samples played in a voice state when a loop point is reached.
- * See AudioCore::AudioRenderer::DecodeFromWaveBuffers
+ * See AudioCore::Renderer::DecodeFromWaveBuffers
*
* @return True if supported, otherwise false.
*/
@@ -373,4 +373,4 @@ public:
u32 error_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/behavior/info_updater.cpp b/src/audio_core/renderer/behavior/info_updater.cpp
index e312eb166..667711e17 100644
--- a/src/audio_core/renderer/behavior/info_updater.cpp
+++ b/src/audio_core/renderer/behavior/info_updater.cpp
@@ -15,7 +15,7 @@
#include "audio_core/renderer/splitter/splitter_context.h"
#include "audio_core/renderer/voice/voice_context.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_,
const u32 process_handle_, BehaviorInfo& behaviour_)
@@ -536,4 +536,4 @@ Result InfoUpdater::CheckConsumedSize() {
return ResultSuccess;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/behavior/info_updater.h b/src/audio_core/renderer/behavior/info_updater.h
index c817d8d8d..fb4b7d25a 100644
--- a/src/audio_core/renderer/behavior/info_updater.h
+++ b/src/audio_core/renderer/behavior/info_updater.h
@@ -8,7 +8,7 @@
#include "common/common_types.h"
#include "core/hle/service/audio/errors.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class BehaviorInfo;
class VoiceContext;
class MixContext;
@@ -202,4 +202,4 @@ private:
BehaviorInfo& behaviour;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp
index 0bd418306..67d43e69a 100644
--- a/src/audio_core/renderer/command/command_buffer.cpp
+++ b/src/audio_core/renderer/command/command_buffer.cpp
@@ -16,7 +16,7 @@
#include "audio_core/renderer/voice/voice_info.h"
#include "audio_core/renderer/voice/voice_state.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
template <typename T, CommandId Id>
T& CommandBuffer::GenerateStart(const s32 node_id) {
@@ -713,4 +713,4 @@ void CommandBuffer::GenerateCompressorCommand(s16 buffer_offset, EffectInfoBase&
GenerateEnd<CompressorCommand>(cmd);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/command_buffer.h b/src/audio_core/renderer/command/command_buffer.h
index 162170846..12e8c2c81 100644
--- a/src/audio_core/renderer/command/command_buffer.h
+++ b/src/audio_core/renderer/command/command_buffer.h
@@ -10,7 +10,7 @@
#include "audio_core/renderer/performance/performance_manager.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct UpsamplerInfo;
struct VoiceState;
class EffectInfoBase;
@@ -465,4 +465,4 @@ private:
void GenerateEnd(T& cmd);
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/command_generator.cpp b/src/audio_core/renderer/command/command_generator.cpp
index fba84c7bd..ccb186209 100644
--- a/src/audio_core/renderer/command/command_generator.cpp
+++ b/src/audio_core/renderer/command/command_generator.cpp
@@ -21,7 +21,7 @@
#include "audio_core/renderer/voice/voice_context.h"
#include "common/alignment.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
CommandGenerator::CommandGenerator(CommandBuffer& command_buffer_,
const CommandListHeader& command_list_header_,
@@ -793,4 +793,4 @@ void CommandGenerator::GeneratePerformanceCommand(
command_buffer.GeneratePerformanceCommand(node_id, state, entry_addresses);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/command_generator.h b/src/audio_core/renderer/command/command_generator.h
index b3cd7b408..38ee2a64e 100644
--- a/src/audio_core/renderer/command/command_generator.h
+++ b/src/audio_core/renderer/command/command_generator.h
@@ -12,7 +12,7 @@
namespace AudioCore {
struct AudioRendererSystemContext;
-namespace AudioRenderer {
+namespace Renderer {
class CommandBuffer;
struct CommandListHeader;
class VoiceContext;
@@ -345,5 +345,5 @@ private:
PerformanceManager* performance_manager;
};
-} // namespace AudioRenderer
+} // namespace Renderer
} // namespace AudioCore
diff --git a/src/audio_core/renderer/command/command_list_header.h b/src/audio_core/renderer/command/command_list_header.h
index 988530b1f..de9ee070b 100644
--- a/src/audio_core/renderer/command/command_list_header.h
+++ b/src/audio_core/renderer/command/command_list_header.h
@@ -8,7 +8,7 @@
#include "audio_core/common/common.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct CommandListHeader {
u64 buffer_size;
@@ -19,4 +19,4 @@ struct CommandListHeader {
u32 sample_rate;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/command_processing_time_estimator.cpp b/src/audio_core/renderer/command/command_processing_time_estimator.cpp
index 3091f587a..a48a016b1 100644
--- a/src/audio_core/renderer/command/command_processing_time_estimator.cpp
+++ b/src/audio_core/renderer/command/command_processing_time_estimator.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/command/command_processing_time_estimator.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
u32 CommandProcessingTimeEstimatorVersion1::Estimate(
const PcmInt16DataSourceVersion1Command& command) const {
@@ -3617,4 +3617,4 @@ u32 CommandProcessingTimeEstimatorVersion5::Estimate(const CompressorCommand& co
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/command_processing_time_estimator.h b/src/audio_core/renderer/command/command_processing_time_estimator.h
index 452217196..1c76e4ba4 100644
--- a/src/audio_core/renderer/command/command_processing_time_estimator.h
+++ b/src/audio_core/renderer/command/command_processing_time_estimator.h
@@ -6,7 +6,7 @@
#include "audio_core/renderer/command/commands.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Estimate the processing time required for all commands.
*/
@@ -251,4 +251,4 @@ private:
u32 buffer_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/adpcm.cpp b/src/audio_core/renderer/command/data_source/adpcm.cpp
index e66ed2990..e7f82d3b3 100644
--- a/src/audio_core/renderer/command/data_source/adpcm.cpp
+++ b/src/audio_core/renderer/command/data_source/adpcm.cpp
@@ -3,23 +3,29 @@
#include <span>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/data_source/adpcm.h"
#include "audio_core/renderer/command/data_source/decode.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void AdpcmDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor,
+void AdpcmDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("AdpcmDataSourceVersion1Command\n\toutput_index {:02X} source sample "
"rate {} target sample rate {} src quality {}\n",
output_index, sample_rate, processor.target_sample_rate, src_quality);
}
-void AdpcmDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) {
+void AdpcmDataSourceVersion1Command::Process(const AudioRenderer::CommandListProcessor& processor) {
auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count)};
+ for (auto& wave_buffer : wave_buffers) {
+ wave_buffer.loop_start_offset = wave_buffer.start_offset;
+ wave_buffer.loop_end_offset = wave_buffer.end_offset;
+ wave_buffer.loop_count = wave_buffer.loop ? -1 : 0;
+ }
+
DecodeFromWaveBuffersArgs args{
.sample_format{SampleFormat::Adpcm},
.output{out_buffer},
@@ -41,18 +47,18 @@ void AdpcmDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& p
DecodeFromWaveBuffers(*processor.memory, args);
}
-bool AdpcmDataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool AdpcmDataSourceVersion1Command::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-void AdpcmDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor,
+void AdpcmDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("AdpcmDataSourceVersion2Command\n\toutput_index {:02X} source sample "
"rate {} target sample rate {} src quality {}\n",
output_index, sample_rate, processor.target_sample_rate, src_quality);
}
-void AdpcmDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) {
+void AdpcmDataSourceVersion2Command::Process(const AudioRenderer::CommandListProcessor& processor) {
auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count)};
@@ -77,8 +83,8 @@ void AdpcmDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& p
DecodeFromWaveBuffers(*processor.memory, args);
}
-bool AdpcmDataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool AdpcmDataSourceVersion2Command::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/adpcm.h b/src/audio_core/renderer/command/data_source/adpcm.h
index a9cf9cee4..487846f0c 100644
--- a/src/audio_core/renderer/command/data_source/adpcm.h
+++ b/src/audio_core/renderer/command/data_source/adpcm.h
@@ -11,11 +11,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command to decode ADPCM-encoded version 1 wavebuffers
* into the output_index mix buffer.
@@ -27,14 +28,14 @@ struct AdpcmDataSourceVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -42,13 +43,13 @@ struct AdpcmDataSourceVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Quality used for sample rate conversion
SrcQuality src_quality;
/// Mix buffer index for decoded samples
s16 output_index;
- /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags)
+ /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags)
u16 flags;
/// Wavebuffer sample rate
u32 sample_rate;
@@ -75,14 +76,14 @@ struct AdpcmDataSourceVersion2Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -90,13 +91,13 @@ struct AdpcmDataSourceVersion2Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Quality used for sample rate conversion
SrcQuality src_quality;
/// Mix buffer index for decoded samples
s16 output_index;
- /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags)
+ /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags)
u16 flags;
/// Wavebuffer sample rate
u32 sample_rate;
@@ -116,4 +117,4 @@ struct AdpcmDataSourceVersion2Command : ICommand {
u64 data_size;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/decode.cpp b/src/audio_core/renderer/command/data_source/decode.cpp
index 257aa866e..911dae3c1 100644
--- a/src/audio_core/renderer/command/data_source/decode.cpp
+++ b/src/audio_core/renderer/command/data_source/decode.cpp
@@ -11,7 +11,7 @@
#include "common/scratch_buffer.h"
#include "core/memory.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
constexpr u32 TempBufferSize = 0x3F00;
constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4};
@@ -123,11 +123,13 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
return 0;
}
- auto samples_to_process{
- std::min(req.end_offset - req.start_offset - req.offset, req.samples_to_read)};
+ auto start_pos{req.start_offset + req.offset};
+ auto samples_to_process{std::min(req.end_offset - start_pos, req.samples_to_read)};
+ if (samples_to_process == 0) {
+ return 0;
+ }
auto samples_to_read{samples_to_process};
- auto start_pos{req.start_offset + req.offset};
auto samples_remaining_in_frame{start_pos % SamplesPerFrame};
auto position_in_frame{(start_pos / SamplesPerFrame) * NibblesPerFrame +
samples_remaining_in_frame};
@@ -225,13 +227,24 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
* @param args - The wavebuffer data, and information for how to decode it.
*/
void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args) {
+ static constexpr auto EndWaveBuffer = [](auto& voice_state, auto& wavebuffer, auto& index,
+ auto& played_samples, auto& consumed) -> void {
+ voice_state.wave_buffer_valid[index] = false;
+ voice_state.loop_count = 0;
+
+ if (wavebuffer.stream_ended) {
+ played_samples = 0;
+ }
+
+ index = (index + 1) % MaxWaveBuffers;
+ consumed++;
+ };
auto& voice_state{*args.voice_state};
auto remaining_sample_count{args.sample_count};
auto fraction{voice_state.fraction};
- const auto sample_rate_ratio{
- (Common::FixedPoint<49, 15>(args.source_sample_rate) / args.target_sample_rate) *
- args.pitch};
+ const auto sample_rate_ratio{Common::FixedPoint<49, 15>(
+ (f32)args.source_sample_rate / (f32)args.target_sample_rate * (f32)args.pitch)};
const auto size_required{fraction + remaining_sample_count * sample_rate_ratio};
if (size_required < 0) {
@@ -298,22 +311,23 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
auto end_offset{wavebuffer.end_offset};
if (wavebuffer.loop && voice_state.loop_count > 0 &&
- wavebuffer.loop_start_offset != 0 && wavebuffer.loop_end_offset != 0 &&
wavebuffer.loop_start_offset <= wavebuffer.loop_end_offset) {
start_offset = wavebuffer.loop_start_offset;
end_offset = wavebuffer.loop_end_offset;
}
- DecodeArg decode_arg{.buffer{wavebuffer.buffer},
- .buffer_size{wavebuffer.buffer_size},
- .start_offset{start_offset},
- .end_offset{end_offset},
- .channel_count{args.channel_count},
- .coefficients{},
- .adpcm_context{nullptr},
- .target_channel{args.channel},
- .offset{offset},
- .samples_to_read{samples_to_read - samples_read}};
+ DecodeArg decode_arg{
+ .buffer{wavebuffer.buffer},
+ .buffer_size{wavebuffer.buffer_size},
+ .start_offset{start_offset},
+ .end_offset{end_offset},
+ .channel_count{args.channel_count},
+ .coefficients{},
+ .adpcm_context{nullptr},
+ .target_channel{args.channel},
+ .offset{offset},
+ .samples_to_read{samples_to_read - samples_read},
+ };
s32 samples_decoded{0};
@@ -350,42 +364,30 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
temp_buffer_pos += samples_decoded;
offset += samples_decoded;
- if (samples_decoded == 0 || offset >= end_offset - start_offset) {
- offset = 0;
- if (!wavebuffer.loop) {
- voice_state.wave_buffer_valid[wavebuffer_index] = false;
- voice_state.loop_count = 0;
-
- if (wavebuffer.stream_ended) {
- played_sample_count = 0;
- }
-
- wavebuffer_index = (wavebuffer_index + 1) % MaxWaveBuffers;
- wavebuffers_consumed++;
- } else {
- voice_state.loop_count++;
- if (wavebuffer.loop_count > 0 &&
- (voice_state.loop_count > wavebuffer.loop_count || samples_decoded == 0)) {
- voice_state.wave_buffer_valid[wavebuffer_index] = false;
- voice_state.loop_count = 0;
-
- if (wavebuffer.stream_ended) {
- played_sample_count = 0;
- }
-
- wavebuffer_index = (wavebuffer_index + 1) % MaxWaveBuffers;
- wavebuffers_consumed++;
- }
-
- if (samples_decoded == 0) {
- is_buffer_starved = true;
- break;
- }
-
- if (args.IsVoicePlayedSampleCountResetAtLoopPointSupported) {
- played_sample_count = 0;
- }
+ if (samples_decoded && offset < end_offset - start_offset) {
+ continue;
+ }
+
+ offset = 0;
+ if (wavebuffer.loop) {
+ voice_state.loop_count++;
+ if (wavebuffer.loop_count >= 0 &&
+ (voice_state.loop_count > wavebuffer.loop_count || samples_decoded == 0)) {
+ EndWaveBuffer(voice_state, wavebuffer, wavebuffer_index, played_sample_count,
+ wavebuffers_consumed);
+ }
+
+ if (samples_decoded == 0) {
+ is_buffer_starved = true;
+ break;
+ }
+
+ if (args.IsVoicePlayedSampleCountResetAtLoopPointSupported) {
+ played_sample_count = 0;
}
+ } else {
+ EndWaveBuffer(voice_state, wavebuffer, wavebuffer_index, played_sample_count,
+ wavebuffers_consumed);
}
}
@@ -423,4 +425,4 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
voice_state.fraction = fraction;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/decode.h b/src/audio_core/renderer/command/data_source/decode.h
index 4d63d6fa8..5f52f32f0 100644
--- a/src/audio_core/renderer/command/data_source/decode.h
+++ b/src/audio_core/renderer/command/data_source/decode.h
@@ -15,7 +15,7 @@ namespace Core::Memory {
class Memory;
}
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct DecodeFromWaveBuffersArgs {
SampleFormat sample_format;
@@ -56,4 +56,4 @@ struct DecodeArg {
*/
void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args);
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/pcm_float.cpp b/src/audio_core/renderer/command/data_source/pcm_float.cpp
index be77fab69..d1f685656 100644
--- a/src/audio_core/renderer/command/data_source/pcm_float.cpp
+++ b/src/audio_core/renderer/command/data_source/pcm_float.cpp
@@ -1,13 +1,13 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/data_source/decode.h"
#include "audio_core/renderer/command/data_source/pcm_float.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void PcmFloatDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor,
+void PcmFloatDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmFloatDataSourceVersion1Command\n\toutput_index {:02X} channel {} "
@@ -16,10 +16,17 @@ void PcmFloatDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& p
processor.target_sample_rate, src_quality);
}
-void PcmFloatDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) {
+void PcmFloatDataSourceVersion1Command::Process(
+ const AudioRenderer::CommandListProcessor& processor) {
auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count);
+ for (auto& wave_buffer : wave_buffers) {
+ wave_buffer.loop_start_offset = wave_buffer.start_offset;
+ wave_buffer.loop_end_offset = wave_buffer.end_offset;
+ wave_buffer.loop_count = wave_buffer.loop ? -1 : 0;
+ }
+
DecodeFromWaveBuffersArgs args{
.sample_format{SampleFormat::PcmFloat},
.output{out_buffer},
@@ -41,11 +48,12 @@ void PcmFloatDataSourceVersion1Command::Process(const ADSP::CommandListProcessor
DecodeFromWaveBuffers(*processor.memory, args);
}
-bool PcmFloatDataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool PcmFloatDataSourceVersion1Command::Verify(
+ const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-void PcmFloatDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor,
+void PcmFloatDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmFloatDataSourceVersion2Command\n\toutput_index {:02X} channel {} "
@@ -54,7 +62,8 @@ void PcmFloatDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& p
processor.target_sample_rate, src_quality);
}
-void PcmFloatDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) {
+void PcmFloatDataSourceVersion2Command::Process(
+ const AudioRenderer::CommandListProcessor& processor) {
auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count);
@@ -79,8 +88,9 @@ void PcmFloatDataSourceVersion2Command::Process(const ADSP::CommandListProcessor
DecodeFromWaveBuffers(*processor.memory, args);
}
-bool PcmFloatDataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool PcmFloatDataSourceVersion2Command::Verify(
+ const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/pcm_float.h b/src/audio_core/renderer/command/data_source/pcm_float.h
index e4af77c20..2c9d1877e 100644
--- a/src/audio_core/renderer/command/data_source/pcm_float.h
+++ b/src/audio_core/renderer/command/data_source/pcm_float.h
@@ -9,11 +9,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command to decode PCM float-encoded version 1 wavebuffers
* into the output_index mix buffer.
@@ -25,14 +26,14 @@ struct PcmFloatDataSourceVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,13 +41,13 @@ struct PcmFloatDataSourceVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Quality used for sample rate conversion
SrcQuality src_quality;
/// Mix buffer index for decoded samples
s16 output_index;
- /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags)
+ /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags)
u16 flags;
/// Wavebuffer sample rate
u32 sample_rate;
@@ -73,14 +74,14 @@ struct PcmFloatDataSourceVersion2Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -88,13 +89,13 @@ struct PcmFloatDataSourceVersion2Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Quality used for sample rate conversion
SrcQuality src_quality;
/// Mix buffer index for decoded samples
s16 output_index;
- /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags)
+ /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags)
u16 flags;
/// Wavebuffer sample rate
u32 sample_rate;
@@ -110,4 +111,4 @@ struct PcmFloatDataSourceVersion2Command : ICommand {
CpuAddr voice_state;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/pcm_int16.cpp b/src/audio_core/renderer/command/data_source/pcm_int16.cpp
index 7a27463e4..c89a5aaac 100644
--- a/src/audio_core/renderer/command/data_source/pcm_int16.cpp
+++ b/src/audio_core/renderer/command/data_source/pcm_int16.cpp
@@ -3,13 +3,13 @@
#include <span>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/data_source/decode.h"
#include "audio_core/renderer/command/data_source/pcm_int16.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void PcmInt16DataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor,
+void PcmInt16DataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmInt16DataSourceVersion1Command\n\toutput_index {:02X} channel {} "
@@ -18,10 +18,17 @@ void PcmInt16DataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& p
processor.target_sample_rate, src_quality);
}
-void PcmInt16DataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) {
+void PcmInt16DataSourceVersion1Command::Process(
+ const AudioRenderer::CommandListProcessor& processor) {
auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count);
+ for (auto& wave_buffer : wave_buffers) {
+ wave_buffer.loop_start_offset = wave_buffer.start_offset;
+ wave_buffer.loop_end_offset = wave_buffer.end_offset;
+ wave_buffer.loop_count = wave_buffer.loop ? -1 : 0;
+ }
+
DecodeFromWaveBuffersArgs args{
.sample_format{SampleFormat::PcmInt16},
.output{out_buffer},
@@ -43,11 +50,12 @@ void PcmInt16DataSourceVersion1Command::Process(const ADSP::CommandListProcessor
DecodeFromWaveBuffers(*processor.memory, args);
}
-bool PcmInt16DataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool PcmInt16DataSourceVersion1Command::Verify(
+ const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-void PcmInt16DataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor,
+void PcmInt16DataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string +=
fmt::format("PcmInt16DataSourceVersion2Command\n\toutput_index {:02X} channel {} "
@@ -56,7 +64,8 @@ void PcmInt16DataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& p
processor.target_sample_rate, src_quality);
}
-void PcmInt16DataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) {
+void PcmInt16DataSourceVersion2Command::Process(
+ const AudioRenderer::CommandListProcessor& processor) {
auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count);
DecodeFromWaveBuffersArgs args{
@@ -80,8 +89,9 @@ void PcmInt16DataSourceVersion2Command::Process(const ADSP::CommandListProcessor
DecodeFromWaveBuffers(*processor.memory, args);
}
-bool PcmInt16DataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool PcmInt16DataSourceVersion2Command::Verify(
+ const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/data_source/pcm_int16.h b/src/audio_core/renderer/command/data_source/pcm_int16.h
index 5de1ad60d..2c013f003 100644
--- a/src/audio_core/renderer/command/data_source/pcm_int16.h
+++ b/src/audio_core/renderer/command/data_source/pcm_int16.h
@@ -9,11 +9,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command to decode PCM s16-encoded version 1 wavebuffers
* into the output_index mix buffer.
@@ -25,14 +26,14 @@ struct PcmInt16DataSourceVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,13 +41,13 @@ struct PcmInt16DataSourceVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Quality used for sample rate conversion
SrcQuality src_quality;
/// Mix buffer index for decoded samples
s16 output_index;
- /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags)
+ /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags)
u16 flags;
/// Wavebuffer sample rate
u32 sample_rate;
@@ -72,26 +73,26 @@ struct PcmInt16DataSourceVersion2Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Quality used for sample rate conversion
SrcQuality src_quality;
/// Mix buffer index for decoded samples
s16 output_index;
- /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags)
+ /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags)
u16 flags;
/// Wavebuffer sample rate
u32 sample_rate;
@@ -107,4 +108,4 @@ struct PcmInt16DataSourceVersion2Command : ICommand {
CpuAddr voice_state;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/aux_.cpp b/src/audio_core/renderer/command/effect/aux_.cpp
index a3e12b3e7..74d9c229f 100644
--- a/src/audio_core/renderer/command/effect/aux_.cpp
+++ b/src/audio_core/renderer/command/effect/aux_.cpp
@@ -1,13 +1,13 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/aux_.h"
#include "audio_core/renderer/effect/aux_.h"
#include "core/core.h"
#include "core/memory.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Reset an AuxBuffer.
*
@@ -175,13 +175,13 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_,
return read_count_;
}
-void AuxCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void AuxCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("AuxCommand\n\tenabled {} input {:02X} output {:02X}\n", effect_enabled,
input, output);
}
-void AuxCommand::Process(const ADSP::CommandListProcessor& processor) {
+void AuxCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto input_buffer{
processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)};
auto output_buffer{
@@ -208,8 +208,8 @@ void AuxCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool AuxCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool AuxCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/aux_.h b/src/audio_core/renderer/command/effect/aux_.h
index 825c93732..da1e55261 100644
--- a/src/audio_core/renderer/command/effect/aux_.h
+++ b/src/audio_core/renderer/command/effect/aux_.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command to read and write an auxiliary buffer, writing the input mix buffer to game
* memory, and reading into the output buffer from game memory.
@@ -24,14 +25,14 @@ struct AuxCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct AuxCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer index
s16 input;
@@ -63,4 +64,4 @@ struct AuxCommand : ICommand {
bool effect_enabled;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/biquad_filter.cpp b/src/audio_core/renderer/command/effect/biquad_filter.cpp
index dea6423dc..3392e7747 100644
--- a/src/audio_core/renderer/command/effect/biquad_filter.cpp
+++ b/src/audio_core/renderer/command/effect/biquad_filter.cpp
@@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/biquad_filter.h"
#include "audio_core/renderer/voice/voice_state.h"
#include "common/bit_cast.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Biquad filter float implementation.
*
@@ -76,14 +76,14 @@ static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> inp
}
}
-void BiquadFilterCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void BiquadFilterCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format(
"BiquadFilterCommand\n\tinput {:02X} output {:02X} needs_init {} use_float_processing {}\n",
input, output, needs_init, use_float_processing);
}
-void BiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) {
+void BiquadFilterCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto state_{reinterpret_cast<VoiceState::BiquadFilterState*>(state)};
if (needs_init) {
*state_ = {};
@@ -103,8 +103,8 @@ void BiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool BiquadFilterCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool BiquadFilterCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/biquad_filter.h b/src/audio_core/renderer/command/effect/biquad_filter.h
index 4c9c42d29..0e903930a 100644
--- a/src/audio_core/renderer/command/effect/biquad_filter.h
+++ b/src/audio_core/renderer/command/effect/biquad_filter.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/voice/voice_state.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for applying a biquad filter to the input mix buffer, saving the results to
* the output mix buffer.
@@ -26,14 +27,14 @@ struct BiquadFilterCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -41,7 +42,7 @@ struct BiquadFilterCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer index
s16 input;
@@ -71,4 +72,4 @@ void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input,
std::array<s16, 3>& b, std::array<s16, 2>& a,
VoiceState::BiquadFilterState& state, const u32 sample_count);
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/capture.cpp b/src/audio_core/renderer/command/effect/capture.cpp
index 042fd286e..f235ce027 100644
--- a/src/audio_core/renderer/command/effect/capture.cpp
+++ b/src/audio_core/renderer/command/effect/capture.cpp
@@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/capture.h"
#include "audio_core/renderer/effect/aux_.h"
#include "core/memory.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Reset an AuxBuffer.
*
@@ -118,13 +118,13 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
return write_count_;
}
-void CaptureCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void CaptureCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("CaptureCommand\n\tenabled {} input {:02X} output {:02X}", effect_enabled,
input, output);
}
-void CaptureCommand::Process(const ADSP::CommandListProcessor& processor) {
+void CaptureCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
if (effect_enabled) {
auto input_buffer{
processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)};
@@ -135,8 +135,8 @@ void CaptureCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool CaptureCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool CaptureCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/capture.h b/src/audio_core/renderer/command/effect/capture.h
index 8670acb24..a0016c6f6 100644
--- a/src/audio_core/renderer/command/effect/capture.h
+++ b/src/audio_core/renderer/command/effect/capture.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for capturing a mix buffer. That is, writing it back to a given game memory
* address.
@@ -24,14 +25,14 @@ struct CaptureCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct CaptureCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer index
s16 input;
@@ -59,4 +60,4 @@ struct CaptureCommand : ICommand {
bool effect_enabled;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/compressor.cpp b/src/audio_core/renderer/command/effect/compressor.cpp
index ee9b68d5b..7ff707f4e 100644
--- a/src/audio_core/renderer/command/effect/compressor.cpp
+++ b/src/audio_core/renderer/command/effect/compressor.cpp
@@ -5,11 +5,11 @@
#include <span>
#include <vector>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/compressor.h"
#include "audio_core/renderer/effect/compressor.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
static void SetCompressorEffectParameter(const CompressorInfo::ParameterVersion2& params,
CompressorInfo::State& state) {
@@ -110,7 +110,7 @@ static void ApplyCompressorEffect(const CompressorInfo::ParameterVersion2& param
}
}
-void CompressorCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void CompressorCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("CompressorCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
for (s16 i = 0; i < parameter.channel_count; i++) {
@@ -123,7 +123,7 @@ void CompressorCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor&
string += "\n";
}
-void CompressorCommand::Process(const ADSP::CommandListProcessor& processor) {
+void CompressorCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
std::array<std::span<const s32>, MaxChannels> input_buffers{};
std::array<std::span<s32>, MaxChannels> output_buffers{};
@@ -148,8 +148,8 @@ void CompressorCommand::Process(const ADSP::CommandListProcessor& processor) {
processor.sample_count);
}
-bool CompressorCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool CompressorCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/compressor.h b/src/audio_core/renderer/command/effect/compressor.h
index f8e96cb43..c011aa927 100644
--- a/src/audio_core/renderer/command/effect/compressor.h
+++ b/src/audio_core/renderer/command/effect/compressor.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/effect/compressor.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for limiting volume between a high and low threshold.
* Version 1.
@@ -26,14 +27,14 @@ struct CompressorCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -41,7 +42,7 @@ struct CompressorCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -57,4 +58,4 @@ struct CompressorCommand : ICommand {
bool effect_enabled;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/delay.cpp b/src/audio_core/renderer/command/effect/delay.cpp
index e536cbb1e..ffb298c07 100644
--- a/src/audio_core/renderer/command/effect/delay.cpp
+++ b/src/audio_core/renderer/command/effect/delay.cpp
@@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/delay.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Update the DelayInfo state according to the given parameters.
*
@@ -194,7 +194,7 @@ static void ApplyDelayEffect(const DelayInfo::ParameterVersion1& params, DelayIn
}
}
-void DelayCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void DelayCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("DelayCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
for (u32 i = 0; i < MaxChannels; i++) {
@@ -207,7 +207,7 @@ void DelayCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proce
string += "\n";
}
-void DelayCommand::Process(const ADSP::CommandListProcessor& processor) {
+void DelayCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
std::array<std::span<const s32>, MaxChannels> input_buffers{};
std::array<std::span<s32>, MaxChannels> output_buffers{};
@@ -231,8 +231,8 @@ void DelayCommand::Process(const ADSP::CommandListProcessor& processor) {
processor.sample_count);
}
-bool DelayCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool DelayCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/delay.h b/src/audio_core/renderer/command/effect/delay.h
index b7a15ae6b..bfeac7af4 100644
--- a/src/audio_core/renderer/command/effect/delay.h
+++ b/src/audio_core/renderer/command/effect/delay.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/effect/delay.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for a delay effect. Delays inputs mix buffers according to the parameters
* and state, outputs receives the delayed samples.
@@ -26,14 +27,14 @@ struct DelayCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -41,7 +42,7 @@ struct DelayCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -57,4 +58,4 @@ struct DelayCommand : ICommand {
bool effect_enabled;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp
index d2bfb67cc..ecfdfabc6 100644
--- a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp
+++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp
@@ -3,11 +3,11 @@
#include <numbers>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/i3dl2_reverb.h"
#include "common/polyfill_ranges.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
constexpr std::array<f32, I3dl2ReverbInfo::MaxDelayLines> MinDelayLineTimes{
5.0f,
@@ -394,7 +394,7 @@ static void ApplyI3dl2ReverbEffect(const I3dl2ReverbInfo::ParameterVersion1& par
}
}
-void I3dl2ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void I3dl2ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("I3dl2ReverbCommand\n\tenabled {} \n\tinputs: ", effect_enabled);
for (u32 i = 0; i < parameter.channel_count; i++) {
@@ -407,7 +407,7 @@ void I3dl2ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor&
string += "\n";
}
-void I3dl2ReverbCommand::Process(const ADSP::CommandListProcessor& processor) {
+void I3dl2ReverbCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
std::array<std::span<const s32>, MaxChannels> input_buffers{};
std::array<std::span<s32>, MaxChannels> output_buffers{};
@@ -431,8 +431,8 @@ void I3dl2ReverbCommand::Process(const ADSP::CommandListProcessor& processor) {
processor.sample_count);
}
-bool I3dl2ReverbCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool I3dl2ReverbCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.h b/src/audio_core/renderer/command/effect/i3dl2_reverb.h
index 243877056..e4c538ae8 100644
--- a/src/audio_core/renderer/command/effect/i3dl2_reverb.h
+++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/effect/i3dl2.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for a I3DL2Reverb effect. Apply a reverb to inputs mix buffer according to
* the I3DL2 spec, outputs receives the results.
@@ -26,14 +27,14 @@ struct I3dl2ReverbCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -41,7 +42,7 @@ struct I3dl2ReverbCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -57,4 +58,4 @@ struct I3dl2ReverbCommand : ICommand {
bool effect_enabled;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/light_limiter.cpp b/src/audio_core/renderer/command/effect/light_limiter.cpp
index 4161a9821..63aa06f5c 100644
--- a/src/audio_core/renderer/command/effect/light_limiter.cpp
+++ b/src/audio_core/renderer/command/effect/light_limiter.cpp
@@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/light_limiter.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Update the LightLimiterInfo state according to the given parameters.
* A no-op.
@@ -133,8 +133,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p
}
}
-void LightLimiterVersion1Command::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void LightLimiterVersion1Command::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("LightLimiterVersion1Command\n\tinputs: ");
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
@@ -146,7 +146,7 @@ void LightLimiterVersion1Command::Dump([[maybe_unused]] const ADSP::CommandListP
string += "\n";
}
-void LightLimiterVersion1Command::Process(const ADSP::CommandListProcessor& processor) {
+void LightLimiterVersion1Command::Process(const AudioRenderer::CommandListProcessor& processor) {
std::array<std::span<const s32>, MaxChannels> input_buffers{};
std::array<std::span<s32>, MaxChannels> output_buffers{};
@@ -172,12 +172,12 @@ void LightLimiterVersion1Command::Process(const ADSP::CommandListProcessor& proc
processor.sample_count, statistics);
}
-bool LightLimiterVersion1Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool LightLimiterVersion1Command::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-void LightLimiterVersion2Command::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void LightLimiterVersion2Command::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("LightLimiterVersion2Command\n\tinputs: \n");
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
@@ -189,7 +189,7 @@ void LightLimiterVersion2Command::Dump([[maybe_unused]] const ADSP::CommandListP
string += "\n";
}
-void LightLimiterVersion2Command::Process(const ADSP::CommandListProcessor& processor) {
+void LightLimiterVersion2Command::Process(const AudioRenderer::CommandListProcessor& processor) {
std::array<std::span<const s32>, MaxChannels> input_buffers{};
std::array<std::span<s32>, MaxChannels> output_buffers{};
@@ -215,8 +215,8 @@ void LightLimiterVersion2Command::Process(const ADSP::CommandListProcessor& proc
processor.sample_count, statistics);
}
-bool LightLimiterVersion2Command::Verify(const ADSP::CommandListProcessor& processor) {
+bool LightLimiterVersion2Command::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/light_limiter.h b/src/audio_core/renderer/command/effect/light_limiter.h
index 5d98272c7..6e3ee1b53 100644
--- a/src/audio_core/renderer/command/effect/light_limiter.h
+++ b/src/audio_core/renderer/command/effect/light_limiter.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/effect/light_limiter.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for limiting volume between a high and low threshold.
* Version 1.
@@ -26,14 +27,14 @@ struct LightLimiterVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -41,7 +42,7 @@ struct LightLimiterVersion1Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -68,21 +69,21 @@ struct LightLimiterVersion2Command : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
*
* @param processor - The CommandListProcessor processing this command.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -100,4 +101,4 @@ struct LightLimiterVersion2Command : ICommand {
bool effect_enabled;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp
index 48a7cba8a..208bbeaf2 100644
--- a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp
+++ b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp
@@ -1,20 +1,20 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/biquad_filter.h"
#include "audio_core/renderer/command/effect/multi_tap_biquad_filter.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void MultiTapBiquadFilterCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void MultiTapBiquadFilterCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format(
"MultiTapBiquadFilterCommand\n\tinput {:02X}\n\toutput {:02X}\n\tneeds_init ({}, {})\n",
input, output, needs_init[0], needs_init[1]);
}
-void MultiTapBiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) {
+void MultiTapBiquadFilterCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
if (filter_tap_count > MaxBiquadFilters) {
LOG_ERROR(Service_Audio, "Too many filter taps! {}", filter_tap_count);
filter_tap_count = MaxBiquadFilters;
@@ -38,8 +38,8 @@ void MultiTapBiquadFilterCommand::Process(const ADSP::CommandListProcessor& proc
}
}
-bool MultiTapBiquadFilterCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool MultiTapBiquadFilterCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h
index 99c2c0830..50fce80b0 100644
--- a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h
+++ b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/voice/voice_info.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for applying multiple biquads at once.
*/
@@ -25,14 +26,14 @@ struct MultiTapBiquadFilterCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,7 +41,7 @@ struct MultiTapBiquadFilterCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer index
s16 input;
@@ -56,4 +57,4 @@ struct MultiTapBiquadFilterCommand : ICommand {
u8 filter_tap_count;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/reverb.cpp b/src/audio_core/renderer/command/effect/reverb.cpp
index fc2f15a5e..7f152a962 100644
--- a/src/audio_core/renderer/command/effect/reverb.cpp
+++ b/src/audio_core/renderer/command/effect/reverb.cpp
@@ -4,11 +4,11 @@
#include <numbers>
#include <ranges>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/effect/reverb.h"
#include "common/polyfill_ranges.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
constexpr std::array<f32, ReverbInfo::MaxDelayLines> FdnMaxDelayLineTimes = {
53.9532470703125f,
@@ -396,7 +396,7 @@ static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, Rever
}
}
-void ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format(
"ReverbCommand\n\tenabled {} long_size_pre_delay_supported {}\n\tinputs: ", effect_enabled,
@@ -411,7 +411,7 @@ void ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proc
string += "\n";
}
-void ReverbCommand::Process(const ADSP::CommandListProcessor& processor) {
+void ReverbCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
std::array<std::span<const s32>, MaxChannels> input_buffers{};
std::array<std::span<s32>, MaxChannels> output_buffers{};
@@ -435,8 +435,8 @@ void ReverbCommand::Process(const ADSP::CommandListProcessor& processor) {
processor.sample_count);
}
-bool ReverbCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool ReverbCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/effect/reverb.h b/src/audio_core/renderer/command/effect/reverb.h
index 328756150..2056c73f2 100644
--- a/src/audio_core/renderer/command/effect/reverb.h
+++ b/src/audio_core/renderer/command/effect/reverb.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/effect/reverb.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for a Reverb effect. Apply a reverb to inputs mix buffer, outputs receives
* the results.
@@ -26,14 +27,14 @@ struct ReverbCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -41,7 +42,7 @@ struct ReverbCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -59,4 +60,4 @@ struct ReverbCommand : ICommand {
bool long_size_pre_delay_supported;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/icommand.h b/src/audio_core/renderer/command/icommand.h
index f2dd41254..10a78ddf2 100644
--- a/src/audio_core/renderer/command/icommand.h
+++ b/src/audio_core/renderer/command/icommand.h
@@ -3,14 +3,18 @@
#pragma once
+#include <string>
+
#include "audio_core/common/common.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+using namespace ::AudioCore::ADSP;
+
enum class CommandId : u8 {
/* 0x00 */ Invalid,
/* 0x01 */ DataSourcePcmInt16Version1,
@@ -59,14 +63,15 @@ struct ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- virtual void Dump(const ADSP::CommandListProcessor& processor, std::string& string) = 0;
+ virtual void Dump(const AudioRenderer::CommandListProcessor& processor,
+ std::string& string) = 0;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- virtual void Process(const ADSP::CommandListProcessor& processor) = 0;
+ virtual void Process(const AudioRenderer::CommandListProcessor& processor) = 0;
/**
* Verify this command's data is valid.
@@ -74,7 +79,7 @@ struct ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- virtual bool Verify(const ADSP::CommandListProcessor& processor) = 0;
+ virtual bool Verify(const AudioRenderer::CommandListProcessor& processor) = 0;
/// Command magic 0xCAFEBABE
u32 magic{};
@@ -90,4 +95,4 @@ struct ICommand {
u32 node_id{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/clear_mix.cpp b/src/audio_core/renderer/command/mix/clear_mix.cpp
index 4f649d6a8..060d7cb28 100644
--- a/src/audio_core/renderer/command/mix/clear_mix.cpp
+++ b/src/audio_core/renderer/command/mix/clear_mix.cpp
@@ -3,22 +3,22 @@
#include <string>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/clear_mix.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void ClearMixBufferCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void ClearMixBufferCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("ClearMixBufferCommand\n");
}
-void ClearMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) {
+void ClearMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
memset(processor.mix_buffers.data(), 0, processor.mix_buffers.size_bytes());
}
-bool ClearMixBufferCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool ClearMixBufferCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/clear_mix.h b/src/audio_core/renderer/command/mix/clear_mix.h
index 956ec0b65..650fa1a8a 100644
--- a/src/audio_core/renderer/command/mix/clear_mix.h
+++ b/src/audio_core/renderer/command/mix/clear_mix.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for a clearing the mix buffers.
* Used at the start of each command list.
@@ -24,14 +25,14 @@ struct ClearMixBufferCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct ClearMixBufferCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/copy_mix.cpp b/src/audio_core/renderer/command/mix/copy_mix.cpp
index 1d49f1644..5d386f95a 100644
--- a/src/audio_core/renderer/command/mix/copy_mix.cpp
+++ b/src/audio_core/renderer/command/mix/copy_mix.cpp
@@ -1,18 +1,18 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/copy_mix.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void CopyMixBufferCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void CopyMixBufferCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("CopyMixBufferCommand\n\tinput {:02X} output {:02X}\n", input_index,
output_index);
}
-void CopyMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) {
+void CopyMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto output{processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count)};
auto input{processor.mix_buffers.subspan(input_index * processor.sample_count,
@@ -20,8 +20,8 @@ void CopyMixBufferCommand::Process(const ADSP::CommandListProcessor& processor)
std::memcpy(output.data(), input.data(), processor.sample_count * sizeof(s32));
}
-bool CopyMixBufferCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool CopyMixBufferCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/copy_mix.h b/src/audio_core/renderer/command/mix/copy_mix.h
index a59007fb6..ae247c3f8 100644
--- a/src/audio_core/renderer/command/mix/copy_mix.h
+++ b/src/audio_core/renderer/command/mix/copy_mix.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for a copying a mix buffer from input to output.
*/
@@ -23,14 +24,14 @@ struct CopyMixBufferCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -38,7 +39,7 @@ struct CopyMixBufferCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer index
s16 input_index;
@@ -46,4 +47,4 @@ struct CopyMixBufferCommand : ICommand {
s16 output_index;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp
index c2bc10061..caedb56b7 100644
--- a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp
+++ b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/common/common.h"
-#include "audio_core/renderer/adsp/command_list_processor.h"
#include "audio_core/renderer/command/mix/depop_for_mix_buffers.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Apply depopping. Add the depopped sample to each incoming new sample, decaying it each time
* according to decay.
@@ -36,13 +36,13 @@ static s32 ApplyDepopMix(std::span<s32> output, const s32 depop_sample,
}
}
-void DepopForMixBuffersCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void DepopForMixBuffersCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("DepopForMixBuffersCommand\n\tinput {:02X} count {} decay {}\n", input,
count, decay.to_float());
}
-void DepopForMixBuffersCommand::Process(const ADSP::CommandListProcessor& processor) {
+void DepopForMixBuffersCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto end_index{std::min(processor.buffer_count, input + count)};
std::span<s32> depop_buff{reinterpret_cast<s32*>(depop_buffer), end_index};
@@ -57,8 +57,8 @@ void DepopForMixBuffersCommand::Process(const ADSP::CommandListProcessor& proces
}
}
-bool DepopForMixBuffersCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool DepopForMixBuffersCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h
index e7268ff27..699d38988 100644
--- a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h
+++ b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h
@@ -9,11 +9,12 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for depopping a mix buffer.
* Adds a cumulation of previous samples to the current mix buffer with a decay.
@@ -25,14 +26,14 @@ struct DepopForMixBuffersCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,7 +41,7 @@ struct DepopForMixBuffersCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Starting input mix buffer index
u32 input;
@@ -52,4 +53,4 @@ struct DepopForMixBuffersCommand : ICommand {
CpuAddr depop_buffer;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/depop_prepare.cpp b/src/audio_core/renderer/command/mix/depop_prepare.cpp
index 69bb78ccc..2faf4681a 100644
--- a/src/audio_core/renderer/command/mix/depop_prepare.cpp
+++ b/src/audio_core/renderer/command/mix/depop_prepare.cpp
@@ -1,15 +1,15 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/depop_prepare.h"
#include "audio_core/renderer/voice/voice_state.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void DepopPrepareCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("DepopPrepareCommand\n\tinputs: ");
for (u32 i = 0; i < buffer_count; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
@@ -17,7 +17,7 @@ void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor
string += "\n";
}
-void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) {
+void DepopPrepareCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto samples{reinterpret_cast<s32*>(previous_samples)};
auto buffer{reinterpret_cast<s32*>(depop_buffer)};
@@ -29,8 +29,8 @@ void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool DepopPrepareCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool DepopPrepareCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/depop_prepare.h b/src/audio_core/renderer/command/mix/depop_prepare.h
index a5465da9a..161a94461 100644
--- a/src/audio_core/renderer/command/mix/depop_prepare.h
+++ b/src/audio_core/renderer/command/mix/depop_prepare.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for preparing depop.
* Adds the previusly output last samples to the depop buffer.
@@ -24,14 +25,14 @@ struct DepopPrepareCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct DepopPrepareCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Depop buffer offset for each mix buffer
std::array<s16, MaxMixBuffers> inputs;
@@ -51,4 +52,4 @@ struct DepopPrepareCommand : ICommand {
CpuAddr depop_buffer;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/mix.cpp b/src/audio_core/renderer/command/mix/mix.cpp
index 8ecf9b05a..8bd689b88 100644
--- a/src/audio_core/renderer/command/mix/mix.cpp
+++ b/src/audio_core/renderer/command/mix/mix.cpp
@@ -5,11 +5,11 @@
#include <limits>
#include <span>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/mix.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Mix input mix buffer into output mix buffer, with volume applied to the input.
*
@@ -28,7 +28,7 @@ static void ApplyMix(std::span<s32> output, std::span<const s32> input, const f3
}
}
-void MixCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void MixCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("MixCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
@@ -37,7 +37,7 @@ void MixCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& process
string += "\n";
}
-void MixCommand::Process(const ADSP::CommandListProcessor& processor) {
+void MixCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto output{processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count)};
auto input{processor.mix_buffers.subspan(input_index * processor.sample_count,
@@ -63,8 +63,8 @@ void MixCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool MixCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool MixCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/mix.h b/src/audio_core/renderer/command/mix/mix.h
index 0201cf171..64c812382 100644
--- a/src/audio_core/renderer/command/mix/mix.h
+++ b/src/audio_core/renderer/command/mix/mix.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume
* applied to the input.
@@ -24,14 +25,14 @@ struct MixCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct MixCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Fixed point precision
u8 precision;
@@ -51,4 +52,4 @@ struct MixCommand : ICommand {
f32 volume;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/mix_ramp.cpp b/src/audio_core/renderer/command/mix/mix_ramp.cpp
index d67123cd8..2f6500da5 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp.cpp
+++ b/src/audio_core/renderer/command/mix/mix_ramp.cpp
@@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/mix_ramp.h"
#include "common/fixed_point.h"
#include "common/logging/log.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
template <size_t Q>
s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 volume_,
@@ -33,7 +33,8 @@ s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 vo
template s32 ApplyMixRamp<15>(std::span<s32>, std::span<const s32>, f32, f32, u32);
template s32 ApplyMixRamp<23>(std::span<s32>, std::span<const s32>, f32, f32, u32);
-void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) {
+void MixRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor,
+ std::string& string) {
const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)};
string += fmt::format("MixRampCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
@@ -44,7 +45,7 @@ void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::stri
string += "\n";
}
-void MixRampCommand::Process(const ADSP::CommandListProcessor& processor) {
+void MixRampCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto output{processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count)};
auto input{processor.mix_buffers.subspan(input_index * processor.sample_count,
@@ -75,8 +76,8 @@ void MixRampCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool MixRampCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool MixRampCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/mix_ramp.h b/src/audio_core/renderer/command/mix/mix_ramp.h
index 52f74a273..92209b53a 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp.h
+++ b/src/audio_core/renderer/command/mix/mix_ramp.h
@@ -9,11 +9,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume
* applied to the input, and volume ramping to smooth out the transition.
@@ -25,14 +26,14 @@ struct MixRampCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,7 +41,7 @@ struct MixRampCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Fixed point precision
u8 precision;
@@ -70,4 +71,4 @@ template <size_t Q>
s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, f32 volume_, f32 ramp_,
u32 sample_count);
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp b/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp
index 43dbef9fc..64138a9bf 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp
+++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp
@@ -1,13 +1,14 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/mix_ramp.h"
#include "audio_core/renderer/command/mix/mix_ramp_grouped.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void MixRampGroupedCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) {
+void MixRampGroupedCommand::Dump(const AudioRenderer::CommandListProcessor& processor,
+ std::string& string) {
string += "MixRampGroupedCommand";
for (u32 i = 0; i < buffer_count; i++) {
string += fmt::format("\n\t{}", i);
@@ -21,7 +22,7 @@ void MixRampGroupedCommand::Dump(const ADSP::CommandListProcessor& processor, st
}
}
-void MixRampGroupedCommand::Process(const ADSP::CommandListProcessor& processor) {
+void MixRampGroupedCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
std::span<s32> prev_samples = {reinterpret_cast<s32*>(previous_samples), MaxMixBuffers};
for (u32 i = 0; i < buffer_count; i++) {
@@ -58,8 +59,8 @@ void MixRampGroupedCommand::Process(const ADSP::CommandListProcessor& processor)
}
}
-bool MixRampGroupedCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool MixRampGroupedCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h
index 3b0ce67ef..9621e42a3 100644
--- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h
+++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h
@@ -9,11 +9,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for mixing multiple input mix buffers to multiple output mix buffers, with
* a volume applied to the input, and volume ramping to smooth out the transition.
@@ -25,14 +26,14 @@ struct MixRampGroupedCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,7 +41,7 @@ struct MixRampGroupedCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Fixed point precision
u8 precision;
@@ -58,4 +59,4 @@ struct MixRampGroupedCommand : ICommand {
CpuAddr previous_samples;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/volume.cpp b/src/audio_core/renderer/command/mix/volume.cpp
index b045fb062..92baf6cc3 100644
--- a/src/audio_core/renderer/command/mix/volume.cpp
+++ b/src/audio_core/renderer/command/mix/volume.cpp
@@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/volume.h"
#include "common/fixed_point.h"
#include "common/logging/log.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Apply volume to the input mix buffer, saving to the output buffer.
*
@@ -29,7 +29,7 @@ static void ApplyUniformGain(std::span<s32> output, std::span<const s32> input,
}
}
-void VolumeCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void VolumeCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("VolumeCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
@@ -38,7 +38,7 @@ void VolumeCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proc
string += "\n";
}
-void VolumeCommand::Process(const ADSP::CommandListProcessor& processor) {
+void VolumeCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
// If input and output buffers are the same, and the volume is 1.0f, this won't do
// anything, so just skip.
if (input_index == output_index && volume == 1.0f) {
@@ -65,8 +65,8 @@ void VolumeCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool VolumeCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool VolumeCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/volume.h b/src/audio_core/renderer/command/mix/volume.h
index 6ae9fb794..fbb8156ca 100644
--- a/src/audio_core/renderer/command/mix/volume.h
+++ b/src/audio_core/renderer/command/mix/volume.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for applying volume to a mix buffer.
*/
@@ -23,14 +24,14 @@ struct VolumeCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -38,7 +39,7 @@ struct VolumeCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Fixed point precision
u8 precision;
@@ -50,4 +51,4 @@ struct VolumeCommand : ICommand {
f32 volume;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/volume_ramp.cpp b/src/audio_core/renderer/command/mix/volume_ramp.cpp
index 424307148..fdc751957 100644
--- a/src/audio_core/renderer/command/mix/volume_ramp.cpp
+++ b/src/audio_core/renderer/command/mix/volume_ramp.cpp
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/mix/volume_ramp.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Apply volume with ramping to the input mix buffer, saving to the output buffer.
*
@@ -38,7 +38,8 @@ static void ApplyLinearEnvelopeGain(std::span<s32> output, std::span<const s32>
}
}
-void VolumeRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) {
+void VolumeRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor,
+ std::string& string) {
const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)};
string += fmt::format("VolumeRampCommand");
string += fmt::format("\n\tinput {:02X}", input_index);
@@ -49,7 +50,7 @@ void VolumeRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::s
string += "\n";
}
-void VolumeRampCommand::Process(const ADSP::CommandListProcessor& processor) {
+void VolumeRampCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto output{processor.mix_buffers.subspan(output_index * processor.sample_count,
processor.sample_count)};
auto input{processor.mix_buffers.subspan(input_index * processor.sample_count,
@@ -77,8 +78,8 @@ void VolumeRampCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool VolumeRampCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool VolumeRampCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/mix/volume_ramp.h b/src/audio_core/renderer/command/mix/volume_ramp.h
index 77b61547e..d9794fb95 100644
--- a/src/audio_core/renderer/command/mix/volume_ramp.h
+++ b/src/audio_core/renderer/command/mix/volume_ramp.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for applying volume to a mix buffer, with ramping for the volume to smooth
* out the transition.
@@ -24,14 +25,14 @@ struct VolumeRampCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct VolumeRampCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Fixed point precision
u8 precision;
@@ -53,4 +54,4 @@ struct VolumeRampCommand : ICommand {
f32 volume;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/performance/performance.cpp b/src/audio_core/renderer/command/performance/performance.cpp
index 4a881547f..f0cfcc9fd 100644
--- a/src/audio_core/renderer/command/performance/performance.cpp
+++ b/src/audio_core/renderer/command/performance/performance.cpp
@@ -1,25 +1,25 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/performance/performance.h"
#include "core/core.h"
#include "core/core_timing.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void PerformanceCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void PerformanceCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("PerformanceCommand\n\tstate {}\n", static_cast<u32>(state));
}
-void PerformanceCommand::Process(const ADSP::CommandListProcessor& processor) {
+void PerformanceCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto base{entry_address.translated_address};
if (state == PerformanceState::Start) {
auto start_time_ptr{reinterpret_cast<u32*>(base + entry_address.entry_start_time_offset)};
*start_time_ptr =
- static_cast<u32>(processor.system->CoreTiming().GetClockTicks() - processor.start_time -
- processor.current_processing_time);
+ static_cast<u32>(processor.system->CoreTiming().GetGlobalTimeUs().count() -
+ processor.start_time - processor.current_processing_time);
} else if (state == PerformanceState::Stop) {
auto processed_time_ptr{
reinterpret_cast<u32*>(base + entry_address.entry_processed_time_offset)};
@@ -27,14 +27,14 @@ void PerformanceCommand::Process(const ADSP::CommandListProcessor& processor) {
reinterpret_cast<u32*>(base + entry_address.header_entry_count_offset)};
*processed_time_ptr =
- static_cast<u32>(processor.system->CoreTiming().GetClockTicks() - processor.start_time -
- processor.current_processing_time);
+ static_cast<u32>(processor.system->CoreTiming().GetGlobalTimeUs().count() -
+ processor.start_time - processor.current_processing_time);
(*entry_count_ptr)++;
}
}
-bool PerformanceCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool PerformanceCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/performance/performance.h b/src/audio_core/renderer/command/performance/performance.h
index 11a7d6c08..522e51e34 100644
--- a/src/audio_core/renderer/command/performance/performance.h
+++ b/src/audio_core/renderer/command/performance/performance.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/performance/performance_manager.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for writing AudioRenderer performance metrics back to the sysmodule.
*/
@@ -25,14 +26,14 @@ struct PerformanceCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,7 +41,7 @@ struct PerformanceCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// State of the performance
PerformanceState state;
@@ -48,4 +49,4 @@ struct PerformanceCommand : ICommand {
PerformanceEntryAddresses entry_address;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp
index 1fd90308a..f9b289887 100644
--- a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp
+++ b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp
@@ -1,13 +1,13 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/resample/downmix_6ch_to_2ch.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void DownMix6chTo2chCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void DownMix6chTo2chCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format("DownMix6chTo2chCommand\n\tinputs: ");
for (u32 i = 0; i < MaxChannels; i++) {
string += fmt::format("{:02X}, ", inputs[i]);
@@ -19,7 +19,7 @@ void DownMix6chTo2chCommand::Dump([[maybe_unused]] const ADSP::CommandListProces
string += "\n";
}
-void DownMix6chTo2chCommand::Process(const ADSP::CommandListProcessor& processor) {
+void DownMix6chTo2chCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
auto in_front_left{
processor.mix_buffers.subspan(inputs[0] * processor.sample_count, processor.sample_count)};
auto in_front_right{
@@ -67,8 +67,8 @@ void DownMix6chTo2chCommand::Process(const ADSP::CommandListProcessor& processor
std::memset(out_back_right.data(), 0, out_back_right.size_bytes());
}
-bool DownMix6chTo2chCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool DownMix6chTo2chCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h
index dc133a73b..96cbc5506 100644
--- a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h
+++ b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h
@@ -9,11 +9,12 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for downmixing 6 channels to 2.
* Channel layout (SMPTE):
@@ -31,14 +32,14 @@ struct DownMix6chTo2chCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -46,7 +47,7 @@ struct DownMix6chTo2chCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Input mix buffer offsets for each channel
std::array<s16, MaxChannels> inputs;
@@ -56,4 +57,4 @@ struct DownMix6chTo2chCommand : ICommand {
std::array<Common::FixedPoint<48, 16>, 4> down_mix_coeff;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/resample/resample.cpp b/src/audio_core/renderer/command/resample/resample.cpp
index 070c9d2b8..51f4ba39e 100644
--- a/src/audio_core/renderer/command/resample/resample.cpp
+++ b/src/audio_core/renderer/command/resample/resample.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/command/resample/resample.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
static void ResampleLowQuality(std::span<s32> output, std::span<const s16> input,
const Common::FixedPoint<49, 15>& sample_rate_ratio,
@@ -880,4 +880,4 @@ void Resample(std::span<s32> output, std::span<const s16> input,
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/resample/resample.h b/src/audio_core/renderer/command/resample/resample.h
index ba9209b82..134aff0c9 100644
--- a/src/audio_core/renderer/command/resample/resample.h
+++ b/src/audio_core/renderer/command/resample/resample.h
@@ -9,7 +9,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Resample an input buffer into an output buffer, according to the sample_rate_ratio.
*
@@ -26,4 +26,4 @@ void Resample(std::span<s32> output, std::span<const s16> input,
const Common::FixedPoint<49, 15>& sample_rate_ratio,
Common::FixedPoint<49, 15>& fraction, u32 samples_to_write, SrcQuality src_quality);
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/resample/upsample.cpp b/src/audio_core/renderer/command/resample/upsample.cpp
index 86ddee1a4..691d70390 100644
--- a/src/audio_core/renderer/command/resample/upsample.cpp
+++ b/src/audio_core/renderer/command/resample/upsample.cpp
@@ -3,11 +3,11 @@
#include <array>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/resample/upsample.h"
#include "audio_core/renderer/upsampler/upsampler_info.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Upsampling impl. Input must be 8K, 16K or 32K, output is 48K.
*
@@ -198,7 +198,7 @@ static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input,
}
}
-auto UpsampleCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+auto UpsampleCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) -> void {
string += fmt::format("UpsampleCommand\n\tsource_sample_count {} source_sample_rate {}",
source_sample_count, source_sample_rate);
@@ -213,7 +213,7 @@ auto UpsampleCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& pr
string += "\n";
}
-void UpsampleCommand::Process(const ADSP::CommandListProcessor& processor) {
+void UpsampleCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
const auto info{reinterpret_cast<UpsamplerInfo*>(upsampler_info)};
const auto input_count{std::min(info->input_count, buffer_count)};
const std::span<const s16> inputs_{reinterpret_cast<const s16*>(inputs), input_count};
@@ -234,8 +234,8 @@ void UpsampleCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool UpsampleCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool UpsampleCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/resample/upsample.h b/src/audio_core/renderer/command/resample/upsample.h
index bfc94e8af..877271ba9 100644
--- a/src/audio_core/renderer/command/resample/upsample.h
+++ b/src/audio_core/renderer/command/resample/upsample.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for upsampling a mix buffer to 48Khz.
* Input must be 8Khz, 16Khz or 32Khz, and output will be 48Khz.
@@ -24,14 +25,14 @@ struct UpsampleCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -39,7 +40,7 @@ struct UpsampleCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Pointer to the output samples buffer.
CpuAddr samples_buffer;
@@ -57,4 +58,4 @@ struct UpsampleCommand : ICommand {
CpuAddr upsampler_info;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/sink/circular_buffer.cpp b/src/audio_core/renderer/command/sink/circular_buffer.cpp
index e2ce59792..e056d15a6 100644
--- a/src/audio_core/renderer/command/sink/circular_buffer.cpp
+++ b/src/audio_core/renderer/command/sink/circular_buffer.cpp
@@ -3,14 +3,14 @@
#include <vector>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/sink/circular_buffer.h"
#include "core/memory.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
- std::string& string) {
+void CircularBufferSinkCommand::Dump(
+ [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) {
string += fmt::format(
"CircularBufferSinkCommand\n\tinput_count {} ring size {:04X} ring pos {:04X}\n\tinputs: ",
input_count, size, pos);
@@ -20,7 +20,7 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro
string += "\n";
}
-void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
+void CircularBufferSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
constexpr s32 min{std::numeric_limits<s16>::min()};
constexpr s32 max{std::numeric_limits<s16>::max()};
@@ -41,8 +41,8 @@ void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& proces
}
}
-bool CircularBufferSinkCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool CircularBufferSinkCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/sink/circular_buffer.h b/src/audio_core/renderer/command/sink/circular_buffer.h
index e7d5be26e..a3234a406 100644
--- a/src/audio_core/renderer/command/sink/circular_buffer.h
+++ b/src/audio_core/renderer/command/sink/circular_buffer.h
@@ -8,11 +8,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for sinking samples to a circular buffer.
*/
@@ -23,14 +24,14 @@ struct CircularBufferSinkCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -38,7 +39,7 @@ struct CircularBufferSinkCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Number of input mix buffers
u32 input_count;
@@ -52,4 +53,4 @@ struct CircularBufferSinkCommand : ICommand {
u32 pos;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/sink/device.cpp b/src/audio_core/renderer/command/sink/device.cpp
index 5f74dd7ad..3480ed475 100644
--- a/src/audio_core/renderer/command/sink/device.cpp
+++ b/src/audio_core/renderer/command/sink/device.cpp
@@ -3,13 +3,13 @@
#include <algorithm>
-#include "audio_core/renderer/adsp/command_list_processor.h"
+#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h"
#include "audio_core/renderer/command/sink/device.h"
#include "audio_core/sink/sink.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
-void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
+void DeviceSinkCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor,
std::string& string) {
string += fmt::format("DeviceSinkCommand\n\t{} session {} input_count {}\n\tinputs: ",
std::string_view(name), session_id, input_count);
@@ -19,7 +19,7 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor&
string += "\n";
}
-void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
+void DeviceSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
constexpr s32 min = std::numeric_limits<s16>::min();
constexpr s32 max = std::numeric_limits<s16>::max();
@@ -51,8 +51,8 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
}
}
-bool DeviceSinkCommand::Verify(const ADSP::CommandListProcessor& processor) {
+bool DeviceSinkCommand::Verify(const AudioRenderer::CommandListProcessor& processor) {
return true;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/command/sink/device.h b/src/audio_core/renderer/command/sink/device.h
index 1099bcf8c..385b51ecc 100644
--- a/src/audio_core/renderer/command/sink/device.h
+++ b/src/audio_core/renderer/command/sink/device.h
@@ -10,11 +10,12 @@
#include "audio_core/renderer/command/icommand.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP::AudioRenderer {
class CommandListProcessor;
}
+namespace AudioCore::Renderer {
+
/**
* AudioRenderer command for sinking samples to an output device.
*/
@@ -25,14 +26,14 @@ struct DeviceSinkCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @param string - The string to print into.
*/
- void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+ void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override;
/**
* Process this command.
*
* @param processor - The CommandListProcessor processing this command.
*/
- void Process(const ADSP::CommandListProcessor& processor) override;
+ void Process(const AudioRenderer::CommandListProcessor& processor) override;
/**
* Verify this command's data is valid.
@@ -40,7 +41,7 @@ struct DeviceSinkCommand : ICommand {
* @param processor - The CommandListProcessor processing this command.
* @return True if the command is valid, otherwise false.
*/
- bool Verify(const ADSP::CommandListProcessor& processor) override;
+ bool Verify(const AudioRenderer::CommandListProcessor& processor) override;
/// Device name
char name[0x100];
@@ -54,4 +55,4 @@ struct DeviceSinkCommand : ICommand {
std::array<s16, MaxChannels> inputs;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/aux_.cpp b/src/audio_core/renderer/effect/aux_.cpp
index 51e780ef1..1c1411eff 100644
--- a/src/audio_core/renderer/effect/aux_.cpp
+++ b/src/audio_core/renderer/effect/aux_.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/aux_.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void AuxInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
const PoolMapper& pool_mapper) {
@@ -90,4 +90,4 @@ CpuAddr AuxInfo::GetWorkbuffer(s32 index) {
return workbuffers[index].GetReference(true);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/aux_.h b/src/audio_core/renderer/effect/aux_.h
index 4d3d9e3d9..c5b3058da 100644
--- a/src/audio_core/renderer/effect/aux_.h
+++ b/src/audio_core/renderer/effect/aux_.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/effect/effect_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Auxiliary Buffer used for Aux commands.
* Send and return buffers are available (names from the game's perspective).
@@ -120,4 +120,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/biquad_filter.cpp b/src/audio_core/renderer/effect/biquad_filter.cpp
index a1efb3231..08161d840 100644
--- a/src/audio_core/renderer/effect/biquad_filter.cpp
+++ b/src/audio_core/renderer/effect/biquad_filter.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/biquad_filter.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void BiquadFilterInfo::Update(BehaviorInfo::ErrorInfo& error_info,
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
@@ -49,4 +49,4 @@ void BiquadFilterInfo::InitializeResultState(EffectResultState& result_state) {}
void BiquadFilterInfo::UpdateResultState(EffectResultState& cpu_state,
EffectResultState& dsp_state) {}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/biquad_filter.h b/src/audio_core/renderer/effect/biquad_filter.h
index f53fd5bab..5a22899ab 100644
--- a/src/audio_core/renderer/effect/biquad_filter.h
+++ b/src/audio_core/renderer/effect/biquad_filter.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/effect/effect_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class BiquadFilterInfo : public EffectInfoBase {
public:
@@ -76,4 +76,4 @@ public:
void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/buffer_mixer.cpp b/src/audio_core/renderer/effect/buffer_mixer.cpp
index 9c8877f01..826e246ec 100644
--- a/src/audio_core/renderer/effect/buffer_mixer.cpp
+++ b/src/audio_core/renderer/effect/buffer_mixer.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/buffer_mixer.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void BufferMixerInfo::Update(BehaviorInfo::ErrorInfo& error_info,
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
@@ -46,4 +46,4 @@ void BufferMixerInfo::InitializeResultState(EffectResultState& result_state) {}
void BufferMixerInfo::UpdateResultState(EffectResultState& cpu_state,
EffectResultState& dsp_state) {}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/buffer_mixer.h b/src/audio_core/renderer/effect/buffer_mixer.h
index 23eed4a8b..0c01ef38d 100644
--- a/src/audio_core/renderer/effect/buffer_mixer.h
+++ b/src/audio_core/renderer/effect/buffer_mixer.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/effect/effect_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class BufferMixerInfo : public EffectInfoBase {
public:
@@ -72,4 +72,4 @@ public:
void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/capture.cpp b/src/audio_core/renderer/effect/capture.cpp
index 3f038efdb..dfa062a59 100644
--- a/src/audio_core/renderer/effect/capture.cpp
+++ b/src/audio_core/renderer/effect/capture.cpp
@@ -4,7 +4,7 @@
#include "audio_core/renderer/effect/aux_.h"
#include "audio_core/renderer/effect/capture.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void CaptureInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
const PoolMapper& pool_mapper) {
@@ -79,4 +79,4 @@ CpuAddr CaptureInfo::GetWorkbuffer(s32 index) {
return workbuffers[index].GetReference(true);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/capture.h b/src/audio_core/renderer/effect/capture.h
index 6fbed8e6b..cbe71e22a 100644
--- a/src/audio_core/renderer/effect/capture.h
+++ b/src/audio_core/renderer/effect/capture.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/effect/effect_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class CaptureInfo : public EffectInfoBase {
public:
@@ -62,4 +62,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/compressor.cpp b/src/audio_core/renderer/effect/compressor.cpp
index 220ae02f9..fea0aefcf 100644
--- a/src/audio_core/renderer/effect/compressor.cpp
+++ b/src/audio_core/renderer/effect/compressor.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/compressor.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void CompressorInfo::Update(BehaviorInfo::ErrorInfo& error_info,
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {}
@@ -37,4 +37,4 @@ CpuAddr CompressorInfo::GetWorkbuffer(s32 index) {
return GetSingleBuffer(index);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/compressor.h b/src/audio_core/renderer/effect/compressor.h
index 019a5ae58..cda55c284 100644
--- a/src/audio_core/renderer/effect/compressor.h
+++ b/src/audio_core/renderer/effect/compressor.h
@@ -10,7 +10,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class CompressorInfo : public EffectInfoBase {
public:
@@ -103,4 +103,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/delay.cpp b/src/audio_core/renderer/effect/delay.cpp
index d9853efd9..e038d4498 100644
--- a/src/audio_core/renderer/effect/delay.cpp
+++ b/src/audio_core/renderer/effect/delay.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/delay.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void DelayInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
const PoolMapper& pool_mapper) {
@@ -90,4 +90,4 @@ CpuAddr DelayInfo::GetWorkbuffer(s32 index) {
return GetSingleBuffer(index);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/delay.h b/src/audio_core/renderer/effect/delay.h
index accc42a06..47417fbc6 100644
--- a/src/audio_core/renderer/effect/delay.h
+++ b/src/audio_core/renderer/effect/delay.h
@@ -11,7 +11,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class DelayInfo : public EffectInfoBase {
public:
@@ -132,4 +132,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/effect_context.cpp b/src/audio_core/renderer/effect/effect_context.cpp
index 74c7801c9..00f6d7822 100644
--- a/src/audio_core/renderer/effect/effect_context.cpp
+++ b/src/audio_core/renderer/effect/effect_context.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/effect_context.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void EffectContext::Initialize(std::span<EffectInfoBase> effect_infos_, const u32 effect_count_,
std::span<EffectResultState> result_states_cpu_,
@@ -38,4 +38,4 @@ void EffectContext::UpdateStateByDspShared() {
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/effect_context.h b/src/audio_core/renderer/effect/effect_context.h
index 8f6d6e7d8..8364c5521 100644
--- a/src/audio_core/renderer/effect/effect_context.h
+++ b/src/audio_core/renderer/effect/effect_context.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/effect/effect_result_state.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class EffectContext {
public:
@@ -72,4 +72,4 @@ private:
size_t dsp_state_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/effect_info_base.h b/src/audio_core/renderer/effect/effect_info_base.h
index dbdccf278..b49503409 100644
--- a/src/audio_core/renderer/effect/effect_info_base.h
+++ b/src/audio_core/renderer/effect/effect_info_base.h
@@ -12,7 +12,7 @@
#include "audio_core/renderer/memory/pool_mapper.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Base of all effects. Holds various data and functions used for all derived effects.
* Should not be used directly.
@@ -432,4 +432,4 @@ protected:
std::array<u8, sizeof(State)> state{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/effect_reset.h b/src/audio_core/renderer/effect/effect_reset.h
index 1ea67e334..c9e3b4b78 100644
--- a/src/audio_core/renderer/effect/effect_reset.h
+++ b/src/audio_core/renderer/effect/effect_reset.h
@@ -14,7 +14,7 @@
#include "audio_core/renderer/effect/reverb.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Reset an effect, and create a new one of the given type.
*
@@ -68,4 +68,4 @@ static void ResetEffect(EffectInfoBase* effect, const EffectInfoBase::Type type)
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/effect_result_state.h b/src/audio_core/renderer/effect/effect_result_state.h
index ae096ad69..f4d4b6086 100644
--- a/src/audio_core/renderer/effect/effect_result_state.h
+++ b/src/audio_core/renderer/effect/effect_result_state.h
@@ -7,10 +7,10 @@
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct EffectResultState {
std::array<u8, 0x80> state;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/i3dl2.cpp b/src/audio_core/renderer/effect/i3dl2.cpp
index 960b29cfc..a3c324c1e 100644
--- a/src/audio_core/renderer/effect/i3dl2.cpp
+++ b/src/audio_core/renderer/effect/i3dl2.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/i3dl2.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void I3dl2ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info,
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
@@ -91,4 +91,4 @@ CpuAddr I3dl2ReverbInfo::GetWorkbuffer(s32 index) {
return GetSingleBuffer(index);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/i3dl2.h b/src/audio_core/renderer/effect/i3dl2.h
index 6e3ffd1d4..e0432b4ae 100644
--- a/src/audio_core/renderer/effect/i3dl2.h
+++ b/src/audio_core/renderer/effect/i3dl2.h
@@ -11,7 +11,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class I3dl2ReverbInfo : public EffectInfoBase {
public:
@@ -198,4 +198,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/light_limiter.cpp b/src/audio_core/renderer/effect/light_limiter.cpp
index 1635a952d..9c8ea3c49 100644
--- a/src/audio_core/renderer/effect/light_limiter.cpp
+++ b/src/audio_core/renderer/effect/light_limiter.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/light_limiter.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void LightLimiterInfo::Update(BehaviorInfo::ErrorInfo& error_info,
const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {
@@ -78,4 +78,4 @@ CpuAddr LightLimiterInfo::GetWorkbuffer(s32 index) {
return GetSingleBuffer(index);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/light_limiter.h b/src/audio_core/renderer/effect/light_limiter.h
index 338d67bbc..7f2ede405 100644
--- a/src/audio_core/renderer/effect/light_limiter.h
+++ b/src/audio_core/renderer/effect/light_limiter.h
@@ -11,7 +11,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class LightLimiterInfo : public EffectInfoBase {
public:
@@ -135,4 +135,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/reverb.cpp b/src/audio_core/renderer/effect/reverb.cpp
index 2d32383d0..4da72469a 100644
--- a/src/audio_core/renderer/effect/reverb.cpp
+++ b/src/audio_core/renderer/effect/reverb.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/effect/reverb.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
const PoolMapper& pool_mapper) {
@@ -90,4 +90,4 @@ CpuAddr ReverbInfo::GetWorkbuffer(s32 index) {
return GetSingleBuffer(index);
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/effect/reverb.h b/src/audio_core/renderer/effect/reverb.h
index 6cc345ef6..52a048da6 100644
--- a/src/audio_core/renderer/effect/reverb.h
+++ b/src/audio_core/renderer/effect/reverb.h
@@ -11,7 +11,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class ReverbInfo : public EffectInfoBase {
public:
@@ -187,4 +187,4 @@ public:
CpuAddr GetWorkbuffer(s32 index) override;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/memory/address_info.h b/src/audio_core/renderer/memory/address_info.h
index bb5c930e1..c81ef1b8a 100644
--- a/src/audio_core/renderer/memory/address_info.h
+++ b/src/audio_core/renderer/memory/address_info.h
@@ -6,7 +6,7 @@
#include "audio_core/renderer/memory/memory_pool_info.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Represents a region of mapped or unmapped memory.
@@ -121,4 +121,4 @@ private:
CpuAddr dsp_address;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/memory/memory_pool_info.cpp b/src/audio_core/renderer/memory/memory_pool_info.cpp
index 9b7824af1..03b44d5f3 100644
--- a/src/audio_core/renderer/memory/memory_pool_info.cpp
+++ b/src/audio_core/renderer/memory/memory_pool_info.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/memory/memory_pool_info.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
CpuAddr MemoryPoolInfo::GetCpuAddress() const {
return cpu_address;
@@ -58,4 +58,4 @@ bool MemoryPoolInfo::IsUsed() const {
return in_use;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/memory/memory_pool_info.h b/src/audio_core/renderer/memory/memory_pool_info.h
index 80c571bc1..2f9c85184 100644
--- a/src/audio_core/renderer/memory/memory_pool_info.h
+++ b/src/audio_core/renderer/memory/memory_pool_info.h
@@ -8,7 +8,7 @@
#include "audio_core/common/common.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* CPU pools are mapped in user memory with the supplied process_handle (see PoolMapper).
*/
@@ -167,4 +167,4 @@ private:
bool in_use{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/memory/pool_mapper.cpp b/src/audio_core/renderer/memory/pool_mapper.cpp
index 7fd2b5f47..999bb746b 100644
--- a/src/audio_core/renderer/memory/pool_mapper.cpp
+++ b/src/audio_core/renderer/memory/pool_mapper.cpp
@@ -6,7 +6,7 @@
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/svc.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
PoolMapper::PoolMapper(u32 process_handle_, bool force_map_)
: process_handle{process_handle_}, force_map{force_map_} {}
@@ -240,4 +240,4 @@ bool PoolMapper::InitializeSystemPool(MemoryPoolInfo& pool, const u8* memory,
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/memory/pool_mapper.h b/src/audio_core/renderer/memory/pool_mapper.h
index 9a691da7a..95ae5d8ea 100644
--- a/src/audio_core/renderer/memory/pool_mapper.h
+++ b/src/audio_core/renderer/memory/pool_mapper.h
@@ -10,7 +10,7 @@
#include "common/common_types.h"
#include "core/hle/service/audio/errors.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class AddressInfo;
/**
@@ -176,4 +176,4 @@ private:
bool force_map;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/mix/mix_context.cpp b/src/audio_core/renderer/mix/mix_context.cpp
index 3a18ae7c2..c712610bb 100644
--- a/src/audio_core/renderer/mix/mix_context.cpp
+++ b/src/audio_core/renderer/mix/mix_context.cpp
@@ -7,7 +7,7 @@
#include "audio_core/renderer/splitter/splitter_context.h"
#include "common/polyfill_ranges.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void MixContext::Initialize(std::span<MixInfo*> sorted_mix_infos_, std::span<MixInfo> mix_infos_,
const u32 count_, std::span<s32> effect_process_order_buffer_,
@@ -139,4 +139,4 @@ EdgeMatrix& MixContext::GetEdgeMatrix() {
return edge_matrix;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/mix/mix_context.h b/src/audio_core/renderer/mix/mix_context.h
index bcd9637da..ce19ec8d6 100644
--- a/src/audio_core/renderer/mix/mix_context.h
+++ b/src/audio_core/renderer/mix/mix_context.h
@@ -10,7 +10,7 @@
#include "audio_core/renderer/nodes/node_states.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class SplitterContext;
/*
@@ -121,4 +121,4 @@ private:
EdgeMatrix edge_matrix{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/mix/mix_info.cpp b/src/audio_core/renderer/mix/mix_info.cpp
index cc18e57ee..5e44bde18 100644
--- a/src/audio_core/renderer/mix/mix_info.cpp
+++ b/src/audio_core/renderer/mix/mix_info.cpp
@@ -7,7 +7,7 @@
#include "audio_core/renderer/nodes/edge_matrix.h"
#include "audio_core/renderer/splitter/splitter_context.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
MixInfo::MixInfo(std::span<s32> effect_order_buffer_, s32 effect_count_, BehaviorInfo& behavior)
: effect_order_buffer{effect_order_buffer_}, effect_count{effect_count_},
@@ -117,4 +117,4 @@ bool MixInfo::HasAnyConnection() const {
return dst_mix_id != UnusedMixId || dst_splitter_id != UnusedSplitterId;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/mix/mix_info.h b/src/audio_core/renderer/mix/mix_info.h
index b5fa4c0c7..7005daa4f 100644
--- a/src/audio_core/renderer/mix/mix_info.h
+++ b/src/audio_core/renderer/mix/mix_info.h
@@ -9,7 +9,7 @@
#include "audio_core/common/common.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class EdgeMatrix;
class SplitterContext;
class EffectContext;
@@ -121,4 +121,4 @@ public:
const bool long_size_pre_delay_supported;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/nodes/bit_array.h b/src/audio_core/renderer/nodes/bit_array.h
index b0d53cd51..d8a2d09d0 100644
--- a/src/audio_core/renderer/nodes/bit_array.h
+++ b/src/audio_core/renderer/nodes/bit_array.h
@@ -7,7 +7,7 @@
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Represents an array of bits used for nodes and edges for the mixing graph.
*/
@@ -22,4 +22,4 @@ struct BitArray {
u32 size{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/nodes/edge_matrix.cpp b/src/audio_core/renderer/nodes/edge_matrix.cpp
index 5573f33b9..c28773b22 100644
--- a/src/audio_core/renderer/nodes/edge_matrix.cpp
+++ b/src/audio_core/renderer/nodes/edge_matrix.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/nodes/edge_matrix.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void EdgeMatrix::Initialize([[maybe_unused]] std::span<u8> buffer,
[[maybe_unused]] const u64 node_buffer_size, const u32 count_) {
@@ -35,4 +35,4 @@ u32 EdgeMatrix::GetNodeCount() const {
return count;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/nodes/edge_matrix.h b/src/audio_core/renderer/nodes/edge_matrix.h
index 27a20e43e..0271c23b1 100644
--- a/src/audio_core/renderer/nodes/edge_matrix.h
+++ b/src/audio_core/renderer/nodes/edge_matrix.h
@@ -9,7 +9,7 @@
#include "common/alignment.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* An edge matrix, holding the connections for each node to every other node in the graph.
*/
@@ -79,4 +79,4 @@ private:
u32 count;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/nodes/node_states.cpp b/src/audio_core/renderer/nodes/node_states.cpp
index b7a44a54c..028a58041 100644
--- a/src/audio_core/renderer/nodes/node_states.cpp
+++ b/src/audio_core/renderer/nodes/node_states.cpp
@@ -4,7 +4,7 @@
#include "audio_core/renderer/nodes/node_states.h"
#include "common/logging/log.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void NodeStates::Initialize(std::span<u8> buffer_, [[maybe_unused]] const u64 node_buffer_size,
const u32 count) {
@@ -138,4 +138,4 @@ std::pair<std::span<u32>::reverse_iterator, size_t> NodeStates::GetSortedResuls(
return {results.rbegin(), result_pos};
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/nodes/node_states.h b/src/audio_core/renderer/nodes/node_states.h
index e768cd4b5..991a82841 100644
--- a/src/audio_core/renderer/nodes/node_states.h
+++ b/src/audio_core/renderer/nodes/node_states.h
@@ -10,7 +10,7 @@
#include "common/alignment.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Graph utility functions for sorting and getting results from the DAG.
*/
@@ -192,4 +192,4 @@ private:
Stack stack{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/detail_aspect.cpp b/src/audio_core/renderer/performance/detail_aspect.cpp
index f6405937f..ef8b47cee 100644
--- a/src/audio_core/renderer/performance/detail_aspect.cpp
+++ b/src/audio_core/renderer/performance/detail_aspect.cpp
@@ -5,7 +5,7 @@
#include "audio_core/renderer/command/command_generator.h"
#include "audio_core/renderer/performance/detail_aspect.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
DetailAspect::DetailAspect(CommandGenerator& command_generator_,
const PerformanceEntryType entry_type, const s32 node_id_,
@@ -22,4 +22,4 @@ DetailAspect::DetailAspect(CommandGenerator& command_generator_,
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/detail_aspect.h b/src/audio_core/renderer/performance/detail_aspect.h
index 736c331b9..0bd7f80c8 100644
--- a/src/audio_core/renderer/performance/detail_aspect.h
+++ b/src/audio_core/renderer/performance/detail_aspect.h
@@ -7,7 +7,7 @@
#include "audio_core/renderer/performance/performance_manager.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class CommandGenerator;
/**
@@ -29,4 +29,4 @@ public:
s32 node_id;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/entry_aspect.cpp b/src/audio_core/renderer/performance/entry_aspect.cpp
index dd4165803..c9241a639 100644
--- a/src/audio_core/renderer/performance/entry_aspect.cpp
+++ b/src/audio_core/renderer/performance/entry_aspect.cpp
@@ -5,7 +5,7 @@
#include "audio_core/renderer/command/command_generator.h"
#include "audio_core/renderer/performance/entry_aspect.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
EntryAspect::EntryAspect(CommandGenerator& command_generator_, const PerformanceEntryType type,
const s32 node_id_)
@@ -20,4 +20,4 @@ EntryAspect::EntryAspect(CommandGenerator& command_generator_, const Performance
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/entry_aspect.h b/src/audio_core/renderer/performance/entry_aspect.h
index 14c9e3baf..f99287d68 100644
--- a/src/audio_core/renderer/performance/entry_aspect.h
+++ b/src/audio_core/renderer/performance/entry_aspect.h
@@ -7,7 +7,7 @@
#include "audio_core/renderer/performance/performance_manager.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class CommandGenerator;
/**
@@ -28,4 +28,4 @@ public:
s32 node_id;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/performance_detail.h b/src/audio_core/renderer/performance/performance_detail.h
index f603b9026..2b0cf9422 100644
--- a/src/audio_core/renderer/performance/performance_detail.h
+++ b/src/audio_core/renderer/performance/performance_detail.h
@@ -6,7 +6,7 @@
#include "audio_core/renderer/performance/performance_entry.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
enum class PerformanceDetailType : u8 {
Invalid,
@@ -47,4 +47,4 @@ struct PerformanceDetailVersion2 {
static_assert(sizeof(PerformanceDetailVersion2) == 0x18,
"PerformanceDetailVersion2 has the wrong size!");
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/performance_entry.h b/src/audio_core/renderer/performance/performance_entry.h
index d6b1158db..dbd6053a5 100644
--- a/src/audio_core/renderer/performance/performance_entry.h
+++ b/src/audio_core/renderer/performance/performance_entry.h
@@ -5,7 +5,7 @@
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
enum class PerformanceEntryType : u8 {
Invalid,
@@ -34,4 +34,4 @@ struct PerformanceEntryVersion2 {
static_assert(sizeof(PerformanceEntryVersion2) == 0x18,
"PerformanceEntryVersion2 has the wrong size!");
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/performance_entry_addresses.h b/src/audio_core/renderer/performance/performance_entry_addresses.h
index e381d765c..51eee975f 100644
--- a/src/audio_core/renderer/performance/performance_entry_addresses.h
+++ b/src/audio_core/renderer/performance/performance_entry_addresses.h
@@ -5,7 +5,7 @@
#include "audio_core/common/common.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct PerformanceEntryAddresses {
CpuAddr translated_address;
@@ -14,4 +14,4 @@ struct PerformanceEntryAddresses {
CpuAddr entry_processed_time_offset;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/performance_frame_header.h b/src/audio_core/renderer/performance/performance_frame_header.h
index b1848284e..24e4989f8 100644
--- a/src/audio_core/renderer/performance/performance_frame_header.h
+++ b/src/audio_core/renderer/performance/performance_frame_header.h
@@ -5,7 +5,7 @@
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct PerformanceFrameHeaderVersion1 {
/* 0x00 */ u32 magic; // "PERF"
@@ -33,4 +33,4 @@ struct PerformanceFrameHeaderVersion2 {
static_assert(sizeof(PerformanceFrameHeaderVersion2) == 0x30,
"PerformanceFrameHeaderVersion2 has the wrong size!");
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/performance_manager.cpp b/src/audio_core/renderer/performance/performance_manager.cpp
index 8aa0f5ed0..ce736db71 100644
--- a/src/audio_core/renderer/performance/performance_manager.cpp
+++ b/src/audio_core/renderer/performance/performance_manager.cpp
@@ -6,7 +6,7 @@
#include "audio_core/renderer/performance/performance_manager.h"
#include "common/common_funcs.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void PerformanceManager::CreateImpl(const size_t version) {
switch (version) {
@@ -643,4 +643,4 @@ void PerformanceManagerImpl<PerformanceVersion::Version2, PerformanceFrameHeader
target_node_id = target_node_id_;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/performance/performance_manager.h b/src/audio_core/renderer/performance/performance_manager.h
index b65caa9b6..ffd0fa1fb 100644
--- a/src/audio_core/renderer/performance/performance_manager.h
+++ b/src/audio_core/renderer/performance/performance_manager.h
@@ -14,7 +14,7 @@
#include "audio_core/renderer/performance/performance_frame_header.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class BehaviorInfo;
class MemoryPoolInfo;
@@ -272,4 +272,4 @@ private:
PerformanceVersion version{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp b/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp
index d91f10402..0ede02b6b 100644
--- a/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp
+++ b/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp
@@ -5,7 +5,7 @@
#include "audio_core/renderer/sink/circular_buffer_sink_info.h"
#include "audio_core/renderer/upsampler/upsampler_manager.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
CircularBufferSinkInfo::CircularBufferSinkInfo() {
state.fill(0);
@@ -73,4 +73,4 @@ void CircularBufferSinkInfo::UpdateForCommandGeneration() {
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/circular_buffer_sink_info.h b/src/audio_core/renderer/sink/circular_buffer_sink_info.h
index 3356213ea..d4e61d641 100644
--- a/src/audio_core/renderer/sink/circular_buffer_sink_info.h
+++ b/src/audio_core/renderer/sink/circular_buffer_sink_info.h
@@ -6,7 +6,7 @@
#include "audio_core/renderer/sink/sink_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Info for a circular buffer sink.
*/
@@ -38,4 +38,4 @@ public:
static_assert(sizeof(CircularBufferSinkInfo) <= sizeof(SinkInfoBase),
"CircularBufferSinkInfo is too large!");
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/device_sink_info.cpp b/src/audio_core/renderer/sink/device_sink_info.cpp
index b7b3d6f1d..2de05e38e 100644
--- a/src/audio_core/renderer/sink/device_sink_info.cpp
+++ b/src/audio_core/renderer/sink/device_sink_info.cpp
@@ -4,7 +4,7 @@
#include "audio_core/renderer/sink/device_sink_info.h"
#include "audio_core/renderer/upsampler/upsampler_manager.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
DeviceSinkInfo::DeviceSinkInfo() {
state.fill(0);
@@ -54,4 +54,4 @@ void DeviceSinkInfo::Update(BehaviorInfo::ErrorInfo& error_info, OutStatus& out_
void DeviceSinkInfo::UpdateForCommandGeneration() {}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/device_sink_info.h b/src/audio_core/renderer/sink/device_sink_info.h
index a1c441454..7974ae820 100644
--- a/src/audio_core/renderer/sink/device_sink_info.h
+++ b/src/audio_core/renderer/sink/device_sink_info.h
@@ -6,7 +6,7 @@
#include "audio_core/renderer/sink/sink_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Info for a device sink.
*/
@@ -37,4 +37,4 @@ public:
};
static_assert(sizeof(DeviceSinkInfo) <= sizeof(SinkInfoBase), "DeviceSinkInfo is too large!");
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/sink_context.cpp b/src/audio_core/renderer/sink/sink_context.cpp
index 634bc1cf9..a4f9cac21 100644
--- a/src/audio_core/renderer/sink/sink_context.cpp
+++ b/src/audio_core/renderer/sink/sink_context.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/sink/sink_context.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void SinkContext::Initialize(std::span<SinkInfoBase> sink_infos_, const u32 sink_count_) {
sink_infos = sink_infos_;
@@ -18,4 +18,4 @@ u32 SinkContext::GetCount() const {
return sink_count;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/sink_context.h b/src/audio_core/renderer/sink/sink_context.h
index 185572e29..66925b48e 100644
--- a/src/audio_core/renderer/sink/sink_context.h
+++ b/src/audio_core/renderer/sink/sink_context.h
@@ -8,7 +8,7 @@
#include "audio_core/renderer/sink/sink_info_base.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Manages output sinks.
*/
@@ -44,4 +44,4 @@ private:
u32 sink_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/sink_info_base.cpp b/src/audio_core/renderer/sink/sink_info_base.cpp
index 4279beaa0..8a064f15a 100644
--- a/src/audio_core/renderer/sink/sink_info_base.cpp
+++ b/src/audio_core/renderer/sink/sink_info_base.cpp
@@ -4,7 +4,7 @@
#include "audio_core/renderer/memory/pool_mapper.h"
#include "audio_core/renderer/sink/sink_info_base.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
void SinkInfoBase::CleanUp() {
type = Type::Invalid;
@@ -48,4 +48,4 @@ u8* SinkInfoBase::GetParameter() {
return parameter.data();
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/sink/sink_info_base.h b/src/audio_core/renderer/sink/sink_info_base.h
index a1b855f20..e10d1cb38 100644
--- a/src/audio_core/renderer/sink/sink_info_base.h
+++ b/src/audio_core/renderer/sink/sink_info_base.h
@@ -11,7 +11,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
struct UpsamplerInfo;
class PoolMapper;
@@ -174,4 +174,4 @@ protected:
parameter{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/splitter/splitter_context.cpp b/src/audio_core/renderer/splitter/splitter_context.cpp
index 7a23ba43f..686150ea6 100644
--- a/src/audio_core/renderer/splitter/splitter_context.cpp
+++ b/src/audio_core/renderer/splitter/splitter_context.cpp
@@ -7,7 +7,7 @@
#include "audio_core/renderer/splitter/splitter_context.h"
#include "common/alignment.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
SplitterDestinationData* SplitterContext::GetDesintationData(const s32 splitter_id,
const s32 destination_id) {
@@ -214,4 +214,4 @@ u64 SplitterContext::CalcWorkBufferSize(const BehaviorInfo& behavior,
return size;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/splitter/splitter_context.h b/src/audio_core/renderer/splitter/splitter_context.h
index 1a63db1d3..556e6dcc3 100644
--- a/src/audio_core/renderer/splitter/splitter_context.h
+++ b/src/audio_core/renderer/splitter/splitter_context.h
@@ -13,7 +13,7 @@ namespace AudioCore {
struct AudioRendererParameterInternal;
class WorkbufferAllocator;
-namespace AudioRenderer {
+namespace Renderer {
class BehaviorInfo;
/**
@@ -185,5 +185,5 @@ private:
bool splitter_bug_fixed{};
};
-} // namespace AudioRenderer
+} // namespace Renderer
} // namespace AudioCore
diff --git a/src/audio_core/renderer/splitter/splitter_destinations_data.cpp b/src/audio_core/renderer/splitter/splitter_destinations_data.cpp
index b27d44896..5ec37e48e 100644
--- a/src/audio_core/renderer/splitter/splitter_destinations_data.cpp
+++ b/src/audio_core/renderer/splitter/splitter_destinations_data.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/splitter/splitter_destinations_data.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
SplitterDestinationData::SplitterDestinationData(const s32 id_) : id{id_} {}
@@ -84,4 +84,4 @@ void SplitterDestinationData::SetNext(SplitterDestinationData* next_) {
next = next_;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/splitter/splitter_destinations_data.h b/src/audio_core/renderer/splitter/splitter_destinations_data.h
index d55ce0ad3..90edfc667 100644
--- a/src/audio_core/renderer/splitter/splitter_destinations_data.h
+++ b/src/audio_core/renderer/splitter/splitter_destinations_data.h
@@ -9,7 +9,7 @@
#include "audio_core/common/common.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Represents a mixing node, can be connected to a previous and next destination forming a chain
* that a certain mix buffer will pass through to output.
@@ -132,4 +132,4 @@ private:
bool need_update{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/splitter/splitter_info.cpp b/src/audio_core/renderer/splitter/splitter_info.cpp
index 1aee6720b..beb5b7f19 100644
--- a/src/audio_core/renderer/splitter/splitter_info.cpp
+++ b/src/audio_core/renderer/splitter/splitter_info.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/splitter/splitter_info.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
SplitterInfo::SplitterInfo(const s32 id_) : id{id_} {}
@@ -76,4 +76,4 @@ void SplitterInfo::SetDestinations(SplitterDestinationData* destinations_) {
destinations = destinations_;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/splitter/splitter_info.h b/src/audio_core/renderer/splitter/splitter_info.h
index b0ad01fe0..c1e4c2df1 100644
--- a/src/audio_core/renderer/splitter/splitter_info.h
+++ b/src/audio_core/renderer/splitter/splitter_info.h
@@ -6,7 +6,7 @@
#include "audio_core/renderer/splitter/splitter_destinations_data.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Represents a splitter, wraps multiple output destinations to split an input mix into.
*/
@@ -104,4 +104,4 @@ private:
u32 channel_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp
index 6e07baa54..d29754634 100644
--- a/src/audio_core/renderer/system.cpp
+++ b/src/audio_core/renderer/system.cpp
@@ -4,12 +4,13 @@
#include <chrono>
#include <span>
+#include "audio_core/adsp/apps/audio_renderer/audio_renderer.h"
+#include "audio_core/adsp/apps/audio_renderer/command_buffer.h"
#include "audio_core/audio_core.h"
#include "audio_core/common/audio_renderer_parameter.h"
#include "audio_core/common/common.h"
#include "audio_core/common/feature_support.h"
#include "audio_core/common/workbuffer_allocator.h"
-#include "audio_core/renderer/adsp/adsp.h"
#include "audio_core/renderer/behavior/info_updater.h"
#include "audio_core/renderer/command/command_buffer.h"
#include "audio_core/renderer/command/command_generator.h"
@@ -34,7 +35,7 @@
#include "core/hle/kernel/k_transfer_memory.h"
#include "core/memory.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) {
BehaviorInfo behavior;
@@ -95,7 +96,8 @@ u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) {
}
System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_)
- : core{core_}, adsp{core.AudioCore().GetADSP()}, adsp_rendered_event{adsp_rendered_event_} {}
+ : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()},
+ adsp_rendered_event{adsp_rendered_event_} {}
Result System::Initialize(const AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
@@ -443,7 +445,7 @@ void System::Stop() {
Result System::Update(std::span<const u8> input, std::span<u8> performance, std::span<u8> output) {
std::scoped_lock l{lock};
- const auto start_time{core.CoreTiming().GetClockTicks()};
+ const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()};
std::memset(output.data(), 0, output.size());
InfoUpdater info_updater(input, output, process_handle, behavior);
@@ -535,7 +537,7 @@ Result System::Update(std::span<const u8> input, std::span<u8> performance, std:
adsp_rendered_event->Clear();
num_times_updated++;
- const auto end_time{core.CoreTiming().GetClockTicks()};
+ const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()};
ticks_spent_updating += end_time - start_time;
return ResultSuccess;
@@ -583,7 +585,7 @@ void System::SendCommandToDsp() {
if (initialized) {
if (active) {
terminate_event.Reset();
- const auto remaining_command_count{adsp.GetRemainCommandCount(session_id)};
+ const auto remaining_command_count{audio_renderer.GetRemainCommandCount(session_id)};
u64 command_size{0};
if (remaining_command_count) {
@@ -607,26 +609,18 @@ void System::SendCommandToDsp() {
time_limit_percent = 70.0f;
}
- ADSP::CommandBuffer command_buffer{
- .buffer{translated_addr},
- .size{command_size},
- .time_limit{
- static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 *
- (static_cast<f32>(render_time_limit_percent) / 100.0f))},
- .remaining_command_count{remaining_command_count},
- .reset_buffers{reset_command_buffers},
- .applet_resource_user_id{applet_resource_user_id},
- .render_time_taken{adsp.GetRenderTimeTaken(session_id)},
- };
-
- adsp.SendCommandBuffer(session_id, command_buffer);
+ auto time_limit{
+ static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 *
+ (static_cast<f32>(render_time_limit_percent) / 100.0f))};
+ audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit,
+ applet_resource_user_id, reset_command_buffers);
reset_command_buffers = false;
command_buffer_size = command_size;
if (remaining_command_count == 0) {
adsp_rendered_event->Signal();
}
} else {
- adsp.ClearRemainCount(session_id);
+ audio_renderer.ClearRemainCommandCount(session_id);
terminate_event.Set();
}
}
@@ -635,7 +629,7 @@ void System::SendCommandToDsp() {
u64 System::GenerateCommand(std::span<u8> in_command_buffer,
[[maybe_unused]] u64 command_buffer_size_) {
PoolMapper::ClearUseState(memory_pool_workbuffer, memory_pool_count);
- const auto start_time{core.CoreTiming().GetClockTicks()};
+ const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()};
auto command_list_header{reinterpret_cast<CommandListHeader*>(in_command_buffer.data())};
@@ -732,10 +726,10 @@ u64 System::GenerateCommand(std::span<u8> in_command_buffer,
effect_context.UpdateStateByDspShared();
}
- const auto end_time{core.CoreTiming().GetClockTicks()};
+ const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()};
total_ticks_elapsed += end_time - start_time;
num_command_lists_generated++;
- render_start_tick = adsp.GetRenderingStartTick(session_id);
+ render_start_tick = audio_renderer.GetRenderingStartTick(session_id);
frames_elapsed++;
return command_buffer.size;
@@ -819,4 +813,4 @@ u32 System::DropVoices(CommandBuffer& command_buffer, u32 estimated_process_time
return voices_dropped;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/system.h b/src/audio_core/renderer/system.h
index e328783b6..8a8341710 100644
--- a/src/audio_core/renderer/system.h
+++ b/src/audio_core/renderer/system.h
@@ -34,12 +34,16 @@ class KTransferMemory;
namespace AudioCore {
struct AudioRendererParameterInternal;
-
-namespace AudioRenderer {
-class CommandBuffer;
namespace ADSP {
class ADSP;
+namespace AudioRenderer {
+class AudioRenderer;
}
+} // namespace ADSP
+
+namespace Renderer {
+using namespace ::AudioCore::ADSP;
+class CommandBuffer;
/**
* Audio Renderer System, the main worker for audio rendering.
@@ -213,8 +217,8 @@ public:
private:
/// Core system
Core::System& core;
- /// Reference to the ADSP for communication
- ADSP::ADSP& adsp;
+ /// Reference to the ADSP's AudioRenderer for communication
+ ::AudioCore::ADSP::AudioRenderer::AudioRenderer& audio_renderer;
/// Is this system initialized?
bool initialized{};
/// Is this system currently active?
@@ -319,5 +323,5 @@ private:
f32 drop_voice_param{1.0f};
};
-} // namespace AudioRenderer
+} // namespace Renderer
} // namespace AudioCore
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp
index 300ecdbf1..a0b8ef29e 100644
--- a/src/audio_core/renderer/system_manager.cpp
+++ b/src/audio_core/renderer/system_manager.cpp
@@ -3,8 +3,8 @@
#include <chrono>
+#include "audio_core/adsp/adsp.h"
#include "audio_core/audio_core.h"
-#include "audio_core/renderer/adsp/adsp.h"
#include "audio_core/renderer/system_manager.h"
#include "common/microprofile.h"
#include "common/thread.h"
@@ -14,24 +14,21 @@
MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager",
MP_RGB(60, 19, 97));
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
SystemManager::SystemManager(Core::System& core_)
- : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {}
+ : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()} {}
SystemManager::~SystemManager() {
Stop();
}
-bool SystemManager::InitializeUnsafe() {
+void SystemManager::InitializeUnsafe() {
if (!active) {
- if (adsp.Start()) {
- active = true;
- thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); });
- }
+ active = true;
+ audio_renderer.Start();
+ thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); });
}
-
- return adsp.GetState() == ADSP::State::Started;
}
void SystemManager::Stop() {
@@ -41,7 +38,7 @@ void SystemManager::Stop() {
active = false;
thread.request_stop();
thread.join();
- adsp.Stop();
+ audio_renderer.Stop();
}
bool SystemManager::Add(System& system_) {
@@ -55,10 +52,7 @@ bool SystemManager::Add(System& system_) {
{
std::scoped_lock l{mutex1};
if (systems.empty()) {
- if (!InitializeUnsafe()) {
- LOG_ERROR(Service_Audio, "Failed to start the AudioRenderer SystemManager");
- return false;
- }
+ InitializeUnsafe();
}
}
@@ -100,9 +94,9 @@ void SystemManager::ThreadFunc(std::stop_token stop_token) {
}
}
- adsp.Signal();
- adsp.Wait();
+ audio_renderer.Signal();
+ audio_renderer.Wait();
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/system_manager.h b/src/audio_core/renderer/system_manager.h
index 9681fd121..62e8e5f15 100644
--- a/src/audio_core/renderer/system_manager.h
+++ b/src/audio_core/renderer/system_manager.h
@@ -18,11 +18,14 @@ struct EventType;
class System;
} // namespace Core
-namespace AudioCore::AudioRenderer {
-namespace ADSP {
+namespace AudioCore::ADSP {
class ADSP;
-class AudioRenderer_Mailbox;
-} // namespace ADSP
+namespace AudioRenderer {
+class AudioRenderer;
+} // namespace AudioRenderer
+} // namespace AudioCore::ADSP
+
+namespace AudioCore::Renderer {
/**
* Manages all audio renderers, responsible for triggering command list generation and signalling
@@ -38,7 +41,7 @@ public:
*
* @return True if successfully initialized, otherwise false.
*/
- bool InitializeUnsafe();
+ void InitializeUnsafe();
/**
* Stop the system manager.
@@ -80,10 +83,8 @@ private:
std::mutex mutex2{};
/// Is the system manager thread active?
std::atomic<bool> active{};
- /// Reference to the ADSP for communication
- ADSP::ADSP& adsp;
- /// AudioRenderer mailbox for communication
- ADSP::AudioRenderer_Mailbox* mailbox{};
+ /// Reference to the ADSP's AudioRenderer for communication
+ ::AudioCore::ADSP::AudioRenderer::AudioRenderer& audio_renderer;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/upsampler/upsampler_info.h b/src/audio_core/renderer/upsampler/upsampler_info.h
index a43c15af3..85c87f137 100644
--- a/src/audio_core/renderer/upsampler/upsampler_info.h
+++ b/src/audio_core/renderer/upsampler/upsampler_info.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/upsampler/upsampler_state.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class UpsamplerManager;
/**
@@ -32,4 +32,4 @@ struct UpsamplerInfo {
std::array<s16, MaxChannels> inputs{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.cpp b/src/audio_core/renderer/upsampler/upsampler_manager.cpp
index 4c76a5066..ef740f6c9 100644
--- a/src/audio_core/renderer/upsampler/upsampler_manager.cpp
+++ b/src/audio_core/renderer/upsampler/upsampler_manager.cpp
@@ -3,7 +3,7 @@
#include "audio_core/renderer/upsampler/upsampler_manager.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
UpsamplerManager::UpsamplerManager(const u32 count_, std::span<UpsamplerInfo> infos_,
std::span<s32> workbuffer_)
@@ -41,4 +41,4 @@ void UpsamplerManager::Free(UpsamplerInfo* info) {
info->enabled = false;
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.h b/src/audio_core/renderer/upsampler/upsampler_manager.h
index 83c697c0c..263e5718b 100644
--- a/src/audio_core/renderer/upsampler/upsampler_manager.h
+++ b/src/audio_core/renderer/upsampler/upsampler_manager.h
@@ -9,7 +9,7 @@
#include "audio_core/renderer/upsampler/upsampler_info.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Manages and has utility functions for upsampler infos.
*/
@@ -42,4 +42,4 @@ private:
std::mutex lock{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/upsampler/upsampler_state.h b/src/audio_core/renderer/upsampler/upsampler_state.h
index 28cebe200..dc7b31d42 100644
--- a/src/audio_core/renderer/upsampler/upsampler_state.h
+++ b/src/audio_core/renderer/upsampler/upsampler_state.h
@@ -8,7 +8,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Upsampling state used by the AudioRenderer across calls.
*/
@@ -37,4 +37,4 @@ struct UpsamplerState {
u8 sample_index;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/voice/voice_channel_resource.h b/src/audio_core/renderer/voice/voice_channel_resource.h
index 26ab4ccce..4f19c2fcc 100644
--- a/src/audio_core/renderer/voice/voice_channel_resource.h
+++ b/src/audio_core/renderer/voice/voice_channel_resource.h
@@ -8,7 +8,7 @@
#include "audio_core/common/common.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Represents one channel for mixing a voice.
*/
@@ -35,4 +35,4 @@ public:
bool in_use{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/voice/voice_context.cpp b/src/audio_core/renderer/voice/voice_context.cpp
index 16a3e839d..c3644e38b 100644
--- a/src/audio_core/renderer/voice/voice_context.cpp
+++ b/src/audio_core/renderer/voice/voice_context.cpp
@@ -6,7 +6,7 @@
#include "audio_core/renderer/voice/voice_context.h"
#include "common/polyfill_ranges.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
VoiceState& VoiceContext::GetDspSharedState(const u32 index) {
if (index >= dsp_states.size()) {
@@ -84,4 +84,4 @@ void VoiceContext::UpdateStateByDspShared() {
std::memcpy(cpu_states.data(), dsp_states.data(), voice_count * sizeof(VoiceState));
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/voice/voice_context.h b/src/audio_core/renderer/voice/voice_context.h
index 43b677154..138ab2773 100644
--- a/src/audio_core/renderer/voice/voice_context.h
+++ b/src/audio_core/renderer/voice/voice_context.h
@@ -10,7 +10,7 @@
#include "audio_core/renderer/voice/voice_state.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Contains all voices, with utility functions for managing them.
*/
@@ -123,4 +123,4 @@ private:
u32 active_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/voice/voice_info.cpp b/src/audio_core/renderer/voice/voice_info.cpp
index c0bfb23fc..6239cfab7 100644
--- a/src/audio_core/renderer/voice/voice_info.cpp
+++ b/src/audio_core/renderer/voice/voice_info.cpp
@@ -6,7 +6,7 @@
#include "audio_core/renderer/voice/voice_info.h"
#include "audio_core/renderer/voice/voice_state.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
VoiceInfo::VoiceInfo() {
Initialize();
@@ -405,4 +405,4 @@ void VoiceInfo::ResetResources(VoiceContext& voice_context) const {
}
}
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/voice/voice_info.h b/src/audio_core/renderer/voice/voice_info.h
index 3c5d3e04f..14a687dcb 100644
--- a/src/audio_core/renderer/voice/voice_info.h
+++ b/src/audio_core/renderer/voice/voice_info.h
@@ -12,7 +12,7 @@
#include "audio_core/renderer/memory/address_info.h"
#include "common/common_types.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
class PoolMapper;
class VoiceContext;
struct VoiceState;
@@ -377,4 +377,4 @@ public:
u8 flush_buffer_count{};
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/audio_core/renderer/voice/voice_state.h b/src/audio_core/renderer/voice/voice_state.h
index ce947233f..c7aee167b 100644
--- a/src/audio_core/renderer/voice/voice_state.h
+++ b/src/audio_core/renderer/voice/voice_state.h
@@ -9,7 +9,7 @@
#include "common/common_types.h"
#include "common/fixed_point.h"
-namespace AudioCore::AudioRenderer {
+namespace AudioCore::Renderer {
/**
* Holds a state for a voice. One is kept host-side, and one is used by the AudioRenderer,
* host-side is updated on the next iteration.
@@ -67,4 +67,4 @@ struct VoiceState {
s32 loop_count;
};
-} // namespace AudioCore::AudioRenderer
+} // namespace AudioCore::Renderer
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 8b420873a..34877b461 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -195,8 +195,6 @@ if (MSVC)
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
)
target_compile_options(common PRIVATE
- /W4
-
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index 4ff2c50e5..e13c5cdc7 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -35,7 +35,6 @@ namespace Core::Crypto {
namespace {
constexpr u64 CURRENT_CRYPTO_REVISION = 0x5;
-constexpr u64 FULL_TICKET_SIZE = 0x400;
using Common::AsArray;
@@ -156,6 +155,10 @@ u64 GetSignatureTypePaddingSize(SignatureType type) {
UNREACHABLE();
}
+bool Ticket::IsValid() const {
+ return !std::holds_alternative<std::monostate>(data);
+}
+
SignatureType Ticket::GetSignatureType() const {
if (const auto* ticket = std::get_if<RSA4096Ticket>(&data)) {
return ticket->sig_type;
@@ -210,6 +213,54 @@ Ticket Ticket::SynthesizeCommon(Key128 title_key, const std::array<u8, 16>& righ
return Ticket{out};
}
+Ticket Ticket::Read(const FileSys::VirtualFile& file) {
+ // Attempt to read up to the largest ticket size, and make sure we read at least a signature
+ // type.
+ std::array<u8, sizeof(RSA4096Ticket)> raw_data{};
+ auto read_size = file->Read(raw_data.data(), raw_data.size(), 0);
+ if (read_size < sizeof(SignatureType)) {
+ LOG_WARNING(Crypto, "Attempted to read ticket file with invalid size {}.", read_size);
+ return Ticket{std::monostate()};
+ }
+ return Read(std::span{raw_data});
+}
+
+Ticket Ticket::Read(std::span<const u8> raw_data) {
+ // Some tools read only 0x180 bytes of ticket data instead of 0x2C0, so
+ // just make sure we have at least the bare minimum of data to work with.
+ SignatureType sig_type;
+ if (raw_data.size() < sizeof(SignatureType)) {
+ LOG_WARNING(Crypto, "Attempted to parse ticket buffer with invalid size {}.",
+ raw_data.size());
+ return Ticket{std::monostate()};
+ }
+ std::memcpy(&sig_type, raw_data.data(), sizeof(sig_type));
+
+ switch (sig_type) {
+ case SignatureType::RSA_4096_SHA1:
+ case SignatureType::RSA_4096_SHA256: {
+ RSA4096Ticket ticket{};
+ std::memcpy(&ticket, raw_data.data(), sizeof(ticket));
+ return Ticket{ticket};
+ }
+ case SignatureType::RSA_2048_SHA1:
+ case SignatureType::RSA_2048_SHA256: {
+ RSA2048Ticket ticket{};
+ std::memcpy(&ticket, raw_data.data(), sizeof(ticket));
+ return Ticket{ticket};
+ }
+ case SignatureType::ECDSA_SHA1:
+ case SignatureType::ECDSA_SHA256: {
+ ECDSATicket ticket{};
+ std::memcpy(&ticket, raw_data.data(), sizeof(ticket));
+ return Ticket{ticket};
+ }
+ default:
+ LOG_WARNING(Crypto, "Attempted to parse ticket buffer with invalid type {}.", sig_type);
+ return Ticket{std::monostate()};
+ }
+}
+
Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed) {
Key128 out{};
@@ -290,9 +341,9 @@ void KeyManager::DeriveGeneralPurposeKeys(std::size_t crypto_revision) {
}
}
-RSAKeyPair<2048> KeyManager::GetETicketRSAKey() const {
+void KeyManager::DeriveETicketRSAKey() {
if (IsAllZeroArray(eticket_extended_kek) || !HasKey(S128KeyType::ETicketRSAKek)) {
- return {};
+ return;
}
const auto eticket_final = GetKey(S128KeyType::ETicketRSAKek);
@@ -304,12 +355,12 @@ RSAKeyPair<2048> KeyManager::GetETicketRSAKey() const {
rsa_1.Transcode(eticket_extended_kek.data() + 0x10, eticket_extended_kek.size() - 0x10,
extended_dec.data(), Op::Decrypt);
- RSAKeyPair<2048> rsa_key{};
- std::memcpy(rsa_key.decryption_key.data(), extended_dec.data(), rsa_key.decryption_key.size());
- std::memcpy(rsa_key.modulus.data(), extended_dec.data() + 0x100, rsa_key.modulus.size());
- std::memcpy(rsa_key.exponent.data(), extended_dec.data() + 0x200, rsa_key.exponent.size());
-
- return rsa_key;
+ std::memcpy(eticket_rsa_keypair.decryption_key.data(), extended_dec.data(),
+ eticket_rsa_keypair.decryption_key.size());
+ std::memcpy(eticket_rsa_keypair.modulus.data(), extended_dec.data() + 0x100,
+ eticket_rsa_keypair.modulus.size());
+ std::memcpy(eticket_rsa_keypair.exponent.data(), extended_dec.data() + 0x200,
+ eticket_rsa_keypair.exponent.size());
}
Key128 DeriveKeyblobMACKey(const Key128& keyblob_key, const Key128& mac_source) {
@@ -447,10 +498,12 @@ std::vector<Ticket> GetTicketblob(const Common::FS::IOFile& ticket_save) {
for (std::size_t offset = 0; offset + 0x4 < buffer.size(); ++offset) {
if (buffer[offset] == 0x4 && buffer[offset + 1] == 0x0 && buffer[offset + 2] == 0x1 &&
buffer[offset + 3] == 0x0) {
- out.emplace_back();
- auto& next = out.back();
- std::memcpy(&next, buffer.data() + offset, sizeof(Ticket));
- offset += FULL_TICKET_SIZE;
+ // NOTE: Assumes ticket blob will only contain RSA-2048 tickets.
+ auto ticket = Ticket::Read(std::span{buffer.data() + offset, sizeof(RSA2048Ticket)});
+ offset += sizeof(RSA2048Ticket);
+ if (ticket.IsValid()) {
+ out.push_back(ticket);
+ }
}
}
@@ -503,25 +556,36 @@ static std::optional<u64> FindTicketOffset(const std::array<u8, size>& data) {
return offset;
}
-std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
- const RSAKeyPair<2048>& key) {
+std::optional<Key128> KeyManager::ParseTicketTitleKey(const Ticket& ticket) {
+ if (!ticket.IsValid()) {
+ LOG_WARNING(Crypto, "Attempted to parse title key of invalid ticket.");
+ return std::nullopt;
+ }
+
+ if (ticket.GetData().rights_id == Key128{}) {
+ LOG_WARNING(Crypto, "Attempted to parse title key of ticket with no rights ID.");
+ return std::nullopt;
+ }
+
const auto issuer = ticket.GetData().issuer;
if (IsAllZeroArray(issuer)) {
+ LOG_WARNING(Crypto, "Attempted to parse title key of ticket with invalid issuer.");
return std::nullopt;
}
+
if (issuer[0] != 'R' || issuer[1] != 'o' || issuer[2] != 'o' || issuer[3] != 't') {
- LOG_INFO(Crypto, "Attempting to parse ticket with non-standard certificate authority.");
+ LOG_WARNING(Crypto, "Parsing ticket with non-standard certificate authority.");
}
- Key128 rights_id = ticket.GetData().rights_id;
-
- if (rights_id == Key128{}) {
- return std::nullopt;
+ if (ticket.GetData().type == TitleKeyType::Common) {
+ return ticket.GetData().title_key_common;
}
- if (!std::any_of(ticket.GetData().title_key_common_pad.begin(),
- ticket.GetData().title_key_common_pad.end(), [](u8 b) { return b != 0; })) {
- return std::make_pair(rights_id, ticket.GetData().title_key_common);
+ if (eticket_rsa_keypair == RSAKeyPair<2048>{}) {
+ LOG_WARNING(
+ Crypto,
+ "Skipping personalized ticket title key parsing due to missing ETicket RSA key-pair.");
+ return std::nullopt;
}
mbedtls_mpi D; // RSA Private Exponent
@@ -534,9 +598,12 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
mbedtls_mpi_init(&S);
mbedtls_mpi_init(&M);
- mbedtls_mpi_read_binary(&D, key.decryption_key.data(), key.decryption_key.size());
- mbedtls_mpi_read_binary(&N, key.modulus.data(), key.modulus.size());
- mbedtls_mpi_read_binary(&S, ticket.GetData().title_key_block.data(), 0x100);
+ const auto& title_key_block = ticket.GetData().title_key_block;
+ mbedtls_mpi_read_binary(&D, eticket_rsa_keypair.decryption_key.data(),
+ eticket_rsa_keypair.decryption_key.size());
+ mbedtls_mpi_read_binary(&N, eticket_rsa_keypair.modulus.data(),
+ eticket_rsa_keypair.modulus.size());
+ mbedtls_mpi_read_binary(&S, title_key_block.data(), title_key_block.size());
mbedtls_mpi_exp_mod(&M, &S, &D, &N, nullptr);
@@ -564,8 +631,7 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
Key128 key_temp{};
std::memcpy(key_temp.data(), m_2.data() + *offset, key_temp.size());
-
- return std::make_pair(rights_id, key_temp);
+ return key_temp;
}
KeyManager::KeyManager() {
@@ -669,6 +735,14 @@ void KeyManager::LoadFromFile(const std::filesystem::path& file_path, bool is_ti
encrypted_keyblobs[index] = Common::HexStringToArray<0xB0>(out[1]);
} else if (out[0].compare(0, 20, "eticket_extended_kek") == 0) {
eticket_extended_kek = Common::HexStringToArray<576>(out[1]);
+ } else if (out[0].compare(0, 19, "eticket_rsa_keypair") == 0) {
+ const auto key_data = Common::HexStringToArray<528>(out[1]);
+ std::memcpy(eticket_rsa_keypair.decryption_key.data(), key_data.data(),
+ eticket_rsa_keypair.decryption_key.size());
+ std::memcpy(eticket_rsa_keypair.modulus.data(), key_data.data() + 0x100,
+ eticket_rsa_keypair.modulus.size());
+ std::memcpy(eticket_rsa_keypair.exponent.data(), key_data.data() + 0x200,
+ eticket_rsa_keypair.exponent.size());
} else {
for (const auto& kv : KEYS_VARIABLE_LENGTH) {
if (!ValidCryptoRevisionString(out[0], kv.second.size(), 2)) {
@@ -1110,56 +1184,38 @@ void KeyManager::DeriveETicket(PartitionDataManager& data,
eticket_extended_kek = data.GetETicketExtendedKek();
WriteKeyToFile(KeyCategory::Console, "eticket_extended_kek", eticket_extended_kek);
+ DeriveETicketRSAKey();
PopulateTickets();
}
void KeyManager::PopulateTickets() {
- const auto rsa_key = GetETicketRSAKey();
-
- if (rsa_key == RSAKeyPair<2048>{}) {
+ if (ticket_databases_loaded) {
return;
}
+ ticket_databases_loaded = true;
- if (!common_tickets.empty() && !personal_tickets.empty()) {
- return;
- }
+ std::vector<Ticket> tickets;
const auto system_save_e1_path =
Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e1";
-
- const Common::FS::IOFile save_e1{system_save_e1_path, Common::FS::FileAccessMode::Read,
- Common::FS::FileType::BinaryFile};
+ if (Common::FS::Exists(system_save_e1_path)) {
+ const Common::FS::IOFile save_e1{system_save_e1_path, Common::FS::FileAccessMode::Read,
+ Common::FS::FileType::BinaryFile};
+ const auto blob1 = GetTicketblob(save_e1);
+ tickets.insert(tickets.end(), blob1.begin(), blob1.end());
+ }
const auto system_save_e2_path =
Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e2";
+ if (Common::FS::Exists(system_save_e2_path)) {
+ const Common::FS::IOFile save_e2{system_save_e2_path, Common::FS::FileAccessMode::Read,
+ Common::FS::FileType::BinaryFile};
+ const auto blob2 = GetTicketblob(save_e2);
+ tickets.insert(tickets.end(), blob2.begin(), blob2.end());
+ }
- const Common::FS::IOFile save_e2{system_save_e2_path, Common::FS::FileAccessMode::Read,
- Common::FS::FileType::BinaryFile};
-
- const auto blob2 = GetTicketblob(save_e2);
- auto res = GetTicketblob(save_e1);
-
- const auto idx = res.size();
- res.insert(res.end(), blob2.begin(), blob2.end());
-
- for (std::size_t i = 0; i < res.size(); ++i) {
- const auto common = i < idx;
- const auto pair = ParseTicket(res[i], rsa_key);
- if (!pair) {
- continue;
- }
-
- const auto& [rid, key] = *pair;
- u128 rights_id;
- std::memcpy(rights_id.data(), rid.data(), rid.size());
-
- if (common) {
- common_tickets[rights_id] = res[i];
- } else {
- personal_tickets[rights_id] = res[i];
- }
-
- SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
+ for (const auto& ticket : tickets) {
+ AddTicket(ticket);
}
}
@@ -1291,41 +1347,33 @@ const std::map<u128, Ticket>& KeyManager::GetPersonalizedTickets() const {
return personal_tickets;
}
-bool KeyManager::AddTicketCommon(Ticket raw) {
- const auto rsa_key = GetETicketRSAKey();
- if (rsa_key == RSAKeyPair<2048>{}) {
- return false;
- }
-
- const auto pair = ParseTicket(raw, rsa_key);
- if (!pair) {
+bool KeyManager::AddTicket(const Ticket& ticket) {
+ if (!ticket.IsValid()) {
+ LOG_WARNING(Crypto, "Attempted to add invalid ticket.");
return false;
}
- const auto& [rid, key] = *pair;
+ const auto& rid = ticket.GetData().rights_id;
u128 rights_id;
std::memcpy(rights_id.data(), rid.data(), rid.size());
- common_tickets[rights_id] = raw;
- SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
- return true;
-}
+ if (ticket.GetData().type == Core::Crypto::TitleKeyType::Common) {
+ common_tickets[rights_id] = ticket;
+ } else {
+ personal_tickets[rights_id] = ticket;
+ }
-bool KeyManager::AddTicketPersonalized(Ticket raw) {
- const auto rsa_key = GetETicketRSAKey();
- if (rsa_key == RSAKeyPair<2048>{}) {
- return false;
+ if (HasKey(S128KeyType::Titlekey, rights_id[1], rights_id[0])) {
+ LOG_DEBUG(Crypto,
+ "Skipping parsing title key from ticket for known rights ID {:016X}{:016X}.",
+ rights_id[1], rights_id[0]);
+ return true;
}
- const auto pair = ParseTicket(raw, rsa_key);
- if (!pair) {
+ const auto key = ParseTicketTitleKey(ticket);
+ if (!key) {
return false;
}
-
- const auto& [rid, key] = *pair;
- u128 rights_id;
- std::memcpy(rights_id.data(), rid.data(), rid.size());
- common_tickets[rights_id] = raw;
- SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
+ SetKey(S128KeyType::Titlekey, key.value(), rights_id[1], rights_id[0]);
return true;
}
} // namespace Core::Crypto
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h
index 8c864503b..2250eccec 100644
--- a/src/core/crypto/key_manager.h
+++ b/src/core/crypto/key_manager.h
@@ -7,6 +7,7 @@
#include <filesystem>
#include <map>
#include <optional>
+#include <span>
#include <string>
#include <variant>
@@ -29,8 +30,6 @@ enum class ResultStatus : u16;
namespace Core::Crypto {
-constexpr u64 TICKET_FILE_TITLEKEY_OFFSET = 0x180;
-
using Key128 = std::array<u8, 0x10>;
using Key256 = std::array<u8, 0x20>;
using SHA256Hash = std::array<u8, 0x20>;
@@ -82,6 +81,7 @@ struct RSA4096Ticket {
INSERT_PADDING_BYTES(0x3C);
TicketData data;
};
+static_assert(sizeof(RSA4096Ticket) == 0x500, "RSA4096Ticket has incorrect size.");
struct RSA2048Ticket {
SignatureType sig_type;
@@ -89,6 +89,7 @@ struct RSA2048Ticket {
INSERT_PADDING_BYTES(0x3C);
TicketData data;
};
+static_assert(sizeof(RSA2048Ticket) == 0x400, "RSA2048Ticket has incorrect size.");
struct ECDSATicket {
SignatureType sig_type;
@@ -96,16 +97,41 @@ struct ECDSATicket {
INSERT_PADDING_BYTES(0x40);
TicketData data;
};
+static_assert(sizeof(ECDSATicket) == 0x340, "ECDSATicket has incorrect size.");
struct Ticket {
- std::variant<RSA4096Ticket, RSA2048Ticket, ECDSATicket> data;
-
- SignatureType GetSignatureType() const;
- TicketData& GetData();
- const TicketData& GetData() const;
- u64 GetSize() const;
-
+ std::variant<std::monostate, RSA4096Ticket, RSA2048Ticket, ECDSATicket> data;
+
+ [[nodiscard]] bool IsValid() const;
+ [[nodiscard]] SignatureType GetSignatureType() const;
+ [[nodiscard]] TicketData& GetData();
+ [[nodiscard]] const TicketData& GetData() const;
+ [[nodiscard]] u64 GetSize() const;
+
+ /**
+ * Synthesizes a common ticket given a title key and rights ID.
+ *
+ * @param title_key Title key to store in the ticket.
+ * @param rights_id Rights ID the ticket is for.
+ * @return The synthesized common ticket.
+ */
static Ticket SynthesizeCommon(Key128 title_key, const std::array<u8, 0x10>& rights_id);
+
+ /**
+ * Reads a ticket from a file.
+ *
+ * @param file File to read the ticket from.
+ * @return The read ticket. If the ticket data is invalid, Ticket::IsValid() will be false.
+ */
+ static Ticket Read(const FileSys::VirtualFile& file);
+
+ /**
+ * Reads a ticket from a memory buffer.
+ *
+ * @param raw_data Buffer to read the ticket from.
+ * @return The read ticket. If the ticket data is invalid, Ticket::IsValid() will be false.
+ */
+ static Ticket Read(std::span<const u8> raw_data);
};
static_assert(sizeof(Key128) == 16, "Key128 must be 128 bytes big.");
@@ -264,8 +290,7 @@ public:
const std::map<u128, Ticket>& GetCommonTickets() const;
const std::map<u128, Ticket>& GetPersonalizedTickets() const;
- bool AddTicketCommon(Ticket raw);
- bool AddTicketPersonalized(Ticket raw);
+ bool AddTicket(const Ticket& ticket);
void ReloadKeys();
bool AreKeysLoaded() const;
@@ -279,10 +304,12 @@ private:
// Map from rights ID to ticket
std::map<u128, Ticket> common_tickets;
std::map<u128, Ticket> personal_tickets;
+ bool ticket_databases_loaded = false;
std::array<std::array<u8, 0xB0>, 0x20> encrypted_keyblobs{};
std::array<std::array<u8, 0x90>, 0x20> keyblobs{};
std::array<u8, 576> eticket_extended_kek{};
+ RSAKeyPair<2048> eticket_rsa_keypair{};
bool dev_mode;
void LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys);
@@ -293,10 +320,13 @@ private:
void DeriveGeneralPurposeKeys(std::size_t crypto_revision);
- RSAKeyPair<2048> GetETicketRSAKey() const;
+ void DeriveETicketRSAKey();
void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0);
void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0);
+
+ /// Parses the title key section of a ticket.
+ std::optional<Key128> ParseTicketTitleKey(const Ticket& ticket);
};
Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed);
@@ -311,9 +341,4 @@ Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& ke
std::vector<Ticket> GetTicketblob(const Common::FS::IOFile& ticket_save);
-// Returns a pair of {rights_id, titlekey}. Fails if the ticket has no certificate authority
-// (offset 0x140-0x144 is zero)
-std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket,
- const RSAKeyPair<2048>& eticket_extended_key);
-
} // namespace Core::Crypto
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp
index e1e89ce2d..68e8ec22f 100644
--- a/src/core/file_sys/submission_package.cpp
+++ b/src/core/file_sys/submission_package.cpp
@@ -164,24 +164,6 @@ VirtualFile NSP::GetNCAFile(u64 title_id, ContentRecordType type, TitleType titl
return nullptr;
}
-std::vector<Core::Crypto::Key128> NSP::GetTitlekey() const {
- if (extracted)
- LOG_WARNING(Service_FS, "called on an NSP that is of type extracted.");
- std::vector<Core::Crypto::Key128> out;
- for (const auto& ticket_file : ticket_files) {
- if (ticket_file == nullptr ||
- ticket_file->GetSize() <
- Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) {
- continue;
- }
-
- out.emplace_back();
- ticket_file->Read(out.back().data(), out.back().size(),
- Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET);
- }
- return out;
-}
-
std::vector<VirtualFile> NSP::GetFiles() const {
return pfs->GetFiles();
}
@@ -208,22 +190,11 @@ void NSP::SetTicketKeys(const std::vector<VirtualFile>& files) {
continue;
}
- if (ticket_file->GetSize() <
- Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) {
+ auto ticket = Core::Crypto::Ticket::Read(ticket_file);
+ if (!keys.AddTicket(ticket)) {
+ LOG_WARNING(Common_Filesystem, "Could not load NSP ticket {}", ticket_file->GetName());
continue;
}
-
- Core::Crypto::Key128 key{};
- ticket_file->Read(key.data(), key.size(), Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET);
-
- // We get the name without the extension in order to create the rights ID.
- std::string name_only(ticket_file->GetName());
- name_only.erase(name_only.size() - 4);
-
- const auto rights_id_raw = Common::HexStringToArray<16>(name_only);
- u128 rights_id;
- std::memcpy(rights_id.data(), rights_id_raw.data(), sizeof(u128));
- keys.SetKey(Core::Crypto::S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
}
}
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h
index 27f97c725..915bffca9 100644
--- a/src/core/file_sys/submission_package.h
+++ b/src/core/file_sys/submission_package.h
@@ -53,7 +53,6 @@ public:
TitleType title_type = TitleType::Application) const;
VirtualFile GetNCAFile(u64 title_id, ContentRecordType type,
TitleType title_type = TitleType::Application) const;
- std::vector<Core::Crypto::Key128> GetTitlekey() const;
std::vector<VirtualFile> GetFiles() const override;
diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp
index 90e4e8fb0..e7da7a21d 100644
--- a/src/core/hle/kernel/k_capabilities.cpp
+++ b/src/core/hle/kernel/k_capabilities.cpp
@@ -156,7 +156,6 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) {
const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize;
const size_t num_pages = 1;
const size_t size = num_pages * PageSize;
- R_UNLESS(num_pages != 0, ResultInvalidSize);
R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress);
R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress);
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/applets/applet_mii_edit.cpp
index d1f652c09..f8e2bac32 100644
--- a/src/core/hle/service/am/applets/applet_mii_edit.cpp
+++ b/src/core/hle/service/am/applets/applet_mii_edit.cpp
@@ -90,7 +90,7 @@ void MiiEdit::Execute() {
const MiiEditCharInfo char_info{
.mii_info{applet_input_common.applet_mode == MiiEditAppletMode::EditMii
? applet_input_v4.char_info.mii_info
- : mii_manager.BuildDefault(0)},
+ : mii_manager.BuildBase(Mii::Gender::Male)},
};
MiiEditOutputForCharInfoEditing(MiiEditResult::Success, char_info);
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp
index 526a39130..56fee4591 100644
--- a/src/core/hle/service/audio/audin_u.cpp
+++ b/src/core/hle/service/audio/audin_u.cpp
@@ -220,7 +220,7 @@ AudInU::AudInU(Core::System& system_)
AudInU::~AudInU() = default;
void AudInU::ListAudioIns(HLERequestContext& ctx) {
- using namespace AudioCore::AudioRenderer;
+ using namespace AudioCore::Renderer;
LOG_DEBUG(Service_Audio, "called");
@@ -240,7 +240,7 @@ void AudInU::ListAudioIns(HLERequestContext& ctx) {
}
void AudInU::ListAudioInsAutoFiltered(HLERequestContext& ctx) {
- using namespace AudioCore::AudioRenderer;
+ using namespace AudioCore::Renderer;
LOG_DEBUG(Service_Audio, "called");
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 23f84a29f..ca683d72c 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -228,7 +228,7 @@ AudOutU::AudOutU(Core::System& system_)
AudOutU::~AudOutU() = default;
void AudOutU::ListAudioOuts(HLERequestContext& ctx) {
- using namespace AudioCore::AudioRenderer;
+ using namespace AudioCore::Renderer;
std::scoped_lock l{impl->mutex};
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index b723b65c8..2f09cade5 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -26,7 +26,7 @@
#include "core/hle/service/ipc_helpers.h"
#include "core/memory.h"
-using namespace AudioCore::AudioRenderer;
+using namespace AudioCore::Renderer;
namespace Service::Audio {
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h
index d8e9c8719..3d7993a16 100644
--- a/src/core/hle/service/audio/audren_u.h
+++ b/src/core/hle/service/audio/audren_u.h
@@ -28,7 +28,7 @@ private:
void GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx);
KernelHelpers::ServiceContext service_context;
- std::unique_ptr<AudioCore::AudioRenderer::Manager> impl;
+ std::unique_ptr<AudioCore::Renderer::Manager> impl;
u32 num_audio_devices{0};
};
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index 446f46b3c..9eaae4c4b 100644
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -122,20 +122,18 @@ private:
}
void ImportTicket(HLERequestContext& ctx) {
- const auto ticket = ctx.ReadBuffer();
+ const auto raw_ticket = ctx.ReadBuffer();
[[maybe_unused]] const auto cert = ctx.ReadBuffer(1);
- if (ticket.size() < sizeof(Core::Crypto::Ticket)) {
+ if (raw_ticket.size() < sizeof(Core::Crypto::Ticket)) {
LOG_ERROR(Service_ETicket, "The input buffer is not large enough!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERROR_INVALID_ARGUMENT);
return;
}
- Core::Crypto::Ticket raw{};
- std::memcpy(&raw, ticket.data(), sizeof(Core::Crypto::Ticket));
-
- if (!keys.AddTicketPersonalized(raw)) {
+ Core::Crypto::Ticket ticket = Core::Crypto::Ticket::Read(raw_ticket);
+ if (!keys.AddTicket(ticket)) {
LOG_ERROR(Service_ETicket, "The ticket could not be imported!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERROR_INVALID_ARGUMENT);
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp
index 46125d473..dd632df50 100644
--- a/src/core/hle/service/mii/mii_manager.cpp
+++ b/src/core/hle/service/mii/mii_manager.cpp
@@ -18,10 +18,9 @@ namespace {
constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4};
-constexpr std::size_t BaseMiiCount{2};
constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()};
-constexpr MiiStoreData::Name DefaultMiiName{u'y', u'u', u'z', u'u'};
+constexpr MiiStoreData::Name DefaultMiiName{u'n', u'o', u' ', u'n', u'a', u'm', u'e'};
constexpr std::array<u8, 8> HairColorLookup{8, 1, 2, 3, 4, 5, 6, 7};
constexpr std::array<u8, 6> EyeColorLookup{8, 9, 10, 11, 12, 13};
constexpr std::array<u8, 5> MouthColorLookup{19, 20, 21, 22, 23};
@@ -404,7 +403,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const {
count += 0;
}
if ((source_flag & SourceFlag::Default) != SourceFlag::None) {
- count += (DefaultMiiCount - BaseMiiCount);
+ count += DefaultMiiCount;
}
return static_cast<u32>(count);
}
@@ -422,13 +421,18 @@ CharInfo MiiManager::BuildRandom(Age age, Gender gender, Race race) {
return ConvertStoreDataToInfo(BuildRandomStoreData(age, gender, race, user_id));
}
+CharInfo MiiManager::BuildBase(Gender gender) {
+ const std::size_t index = gender == Gender::Female ? 1 : 0;
+ return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::BaseMii.at(index), user_id));
+}
+
CharInfo MiiManager::BuildDefault(std::size_t index) {
return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::DefaultMii.at(index), user_id));
}
CharInfo MiiManager::ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const {
Service::Mii::MiiManager manager;
- auto mii = manager.BuildDefault(0);
+ auto mii = manager.BuildBase(Mii::Gender::Male);
if (!ValidateV3Info(mii_v3)) {
return mii;
@@ -678,7 +682,7 @@ std::vector<MiiInfoElement> MiiManager::GetDefault(SourceFlag source_flag) {
return result;
}
- for (std::size_t index = BaseMiiCount; index < DefaultMiiCount; index++) {
+ for (std::size_t index = 0; index < DefaultMiiCount; index++) {
result.emplace_back(BuildDefault(index), Source::Default);
}
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h
index 45c2be3c8..0c8295ebe 100644
--- a/src/core/hle/service/mii/mii_manager.h
+++ b/src/core/hle/service/mii/mii_manager.h
@@ -21,6 +21,7 @@ public:
u32 GetCount(SourceFlag source_flag) const;
Result UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag);
CharInfo BuildRandom(Age age, Gender gender, Race race);
+ CharInfo BuildBase(Gender gender);
CharInfo BuildDefault(std::size_t index);
CharInfo ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const;
bool ValidateV3Info(const Ver3StoreData& mii_v3) const;
diff --git a/src/core/hle/service/mii/raw_data.cpp b/src/core/hle/service/mii/raw_data.cpp
index 1442280c8..e5245b791 100644
--- a/src/core/hle/service/mii/raw_data.cpp
+++ b/src/core/hle/service/mii/raw_data.cpp
@@ -5,7 +5,7 @@
namespace Service::Mii::RawData {
-const std::array<Service::Mii::DefaultMii, 8> DefaultMii{
+const std::array<Service::Mii::DefaultMii, 2> BaseMii{
Service::Mii::DefaultMii{
.face_type = 0,
.face_color = 0,
@@ -108,6 +108,9 @@ const std::array<Service::Mii::DefaultMii, 8> DefaultMii{
.font_region = FontRegion::Standard,
.type = 0,
},
+};
+
+const std::array<Service::Mii::DefaultMii, 6> DefaultMii{
Service::Mii::DefaultMii{
.face_type = 0,
.face_color = 4,
diff --git a/src/core/hle/service/mii/raw_data.h b/src/core/hle/service/mii/raw_data.h
index c2bec68d4..cdd2337d6 100644
--- a/src/core/hle/service/mii/raw_data.h
+++ b/src/core/hle/service/mii/raw_data.h
@@ -9,7 +9,8 @@
namespace Service::Mii::RawData {
-extern const std::array<Service::Mii::DefaultMii, 8> DefaultMii;
+extern const std::array<Service::Mii::DefaultMii, 2> BaseMii;
+extern const std::array<Service::Mii::DefaultMii, 6> DefaultMii;
extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline;
extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor;
extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFacelineWrinkle;
diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp
index 49446bc42..5df40f9a0 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -826,7 +826,7 @@ Result NfcDevice::SetRegisterInfoPrivate(const NFP::RegisterInfoPrivate& registe
}
Service::Mii::MiiManager manager;
- const auto mii = manager.BuildDefault(0);
+ const auto mii = manager.BuildBase(Mii::Gender::Male);
auto& settings = tag_data.settings;
if (tag_data.settings.settings.amiibo_initialized == 0) {
@@ -1467,7 +1467,7 @@ void NfcDevice::BuildAmiiboWithoutKeys(NFP::NTAG215File& stubbed_tag_data,
SetAmiiboName(settings, {'y', 'u', 'z', 'u', 'A', 'm', 'i', 'i', 'b', 'o'});
settings.settings.font_region.Assign(0);
settings.init_date = GetAmiiboDate(GetCurrentPosixTime());
- stubbed_tag_data.owner_mii = manager.BuildFromStoreData(manager.BuildDefault(0));
+ stubbed_tag_data.owner_mii = manager.BuildFromStoreData(manager.BuildBase(Mii::Gender::Male));
// Admin info
settings.settings.amiibo_initialized.Assign(1);
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp
index a51ca5444..0ca05257e 100644
--- a/src/core/hle/service/nvdrv/core/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/core/nvmap.cpp
@@ -160,8 +160,8 @@ u32 NvMap::PinHandle(NvMap::Handle::Id handle) {
u32 address{};
auto& smmu_allocator = host1x.Allocator();
auto& smmu_memory_manager = host1x.MemoryManager();
- while (!(address =
- smmu_allocator.Allocate(static_cast<u32>(handle_description->aligned_size)))) {
+ while ((address = smmu_allocator.Allocate(
+ static_cast<u32>(handle_description->aligned_size))) == 0) {
// Free handles until the allocation succeeds
std::scoped_lock queueLock(unmap_queue_lock);
if (auto freeHandleDesc{unmap_queue.front()}) {
diff --git a/src/core/hle/service/ssl/ssl_backend_schannel.cpp b/src/core/hle/service/ssl/ssl_backend_schannel.cpp
index d834a0c1f..212057cfc 100644
--- a/src/core/hle/service/ssl/ssl_backend_schannel.cpp
+++ b/src/core/hle/service/ssl/ssl_backend_schannel.cpp
@@ -477,7 +477,8 @@ public:
return ResultInternalError;
}
PCCERT_CONTEXT some_cert = nullptr;
- while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert))) {
+ while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert)) !=
+ nullptr) {
out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded),
static_cast<u8*>(some_cert->pbCertEncoded) +
some_cert->cbCertEncoded);
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 07c65dc1a..b6e355622 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -108,7 +108,7 @@ std::string GetFileTypeString(FileType type) {
return "unknown";
}
-constexpr std::array<const char*, 66> RESULT_MESSAGES{
+constexpr std::array<const char*, 68> RESULT_MESSAGES{
"The operation completed successfully.",
"The loader requested to load is already loaded.",
"The operation is not implemented.",
@@ -175,6 +175,8 @@ constexpr std::array<const char*, 66> RESULT_MESSAGES{
"The KIP BLZ decompression of the section failed unexpectedly.",
"The INI file has a bad header.",
"The INI file contains more than the maximum allowable number of KIP files.",
+ "Integrity verification could not be performed for this file.",
+ "Integrity verification failed.",
};
std::string GetResultStatusString(ResultStatus status) {
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 721eb8e8c..b4828f7cd 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -3,6 +3,7 @@
#pragma once
+#include <functional>
#include <iosfwd>
#include <memory>
#include <optional>
@@ -132,6 +133,8 @@ enum class ResultStatus : u16 {
ErrorBLZDecompressionFailed,
ErrorBadINIHeader,
ErrorINITooManyKIPs,
+ ErrorIntegrityVerificationNotImplemented,
+ ErrorIntegrityVerificationFailed,
};
std::string GetResultStatusString(ResultStatus status);
@@ -170,6 +173,13 @@ public:
virtual LoadResult Load(Kernel::KProcess& process, Core::System& system) = 0;
/**
+ * Try to verify the integrity of the file.
+ */
+ virtual ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) {
+ return ResultStatus::ErrorIntegrityVerificationNotImplemented;
+ }
+
+ /**
* Get the code (typically .code section) of the application
*
* @param[out] buffer Reference to buffer to store data
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp
index 09d40e695..4feb6968a 100644
--- a/src/core/loader/nca.cpp
+++ b/src/core/loader/nca.cpp
@@ -3,6 +3,8 @@
#include <utility>
+#include "common/hex_util.h"
+#include "common/scope_exit.h"
#include "core/core.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/nca_metadata.h"
@@ -12,6 +14,7 @@
#include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/deconstructed_rom_directory.h"
#include "core/loader/nca.h"
+#include "mbedtls/sha256.h"
namespace Loader {
@@ -80,6 +83,79 @@ AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::KProcess& process, Core::S
return load_result;
}
+ResultStatus AppLoader_NCA::VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) {
+ using namespace Common::Literals;
+
+ constexpr size_t NcaFileNameWithHashLength = 36;
+ constexpr size_t NcaFileNameHashLength = 32;
+ constexpr size_t NcaSha256HashLength = 32;
+ constexpr size_t NcaSha256HalfHashLength = NcaSha256HashLength / 2;
+
+ // Get the file name.
+ const auto name = file->GetName();
+
+ // We won't try to verify meta NCAs.
+ if (name.ends_with(".cnmt.nca")) {
+ return ResultStatus::Success;
+ }
+
+ // Check if we can verify this file. NCAs should be named after their hashes.
+ if (!name.ends_with(".nca") || name.size() != NcaFileNameWithHashLength) {
+ LOG_WARNING(Loader, "Unable to validate NCA with name {}", name);
+ return ResultStatus::ErrorIntegrityVerificationNotImplemented;
+ }
+
+ // Get the expected truncated hash of the NCA.
+ const auto input_hash =
+ Common::HexStringToVector(file->GetName().substr(0, NcaFileNameHashLength), false);
+
+ // Declare buffer to read into.
+ std::vector<u8> buffer(4_MiB);
+
+ // Initialize sha256 verification context.
+ mbedtls_sha256_context ctx;
+ mbedtls_sha256_init(&ctx);
+ mbedtls_sha256_starts_ret(&ctx, 0);
+
+ // Ensure we maintain a clean state on exit.
+ SCOPE_EXIT({ mbedtls_sha256_free(&ctx); });
+
+ // Declare counters.
+ const size_t total_size = file->GetSize();
+ size_t processed_size = 0;
+
+ // Begin iterating the file.
+ while (processed_size < total_size) {
+ // Refill the buffer.
+ const size_t intended_read_size = std::min(buffer.size(), total_size - processed_size);
+ const size_t read_size = file->Read(buffer.data(), intended_read_size, processed_size);
+
+ // Update the hash function with the buffer contents.
+ mbedtls_sha256_update_ret(&ctx, buffer.data(), read_size);
+
+ // Update counters.
+ processed_size += read_size;
+
+ // Call the progress function.
+ if (!progress_callback(processed_size, total_size)) {
+ return ResultStatus::ErrorIntegrityVerificationFailed;
+ }
+ }
+
+ // Finalize context and compute the output hash.
+ std::array<u8, NcaSha256HashLength> output_hash;
+ mbedtls_sha256_finish_ret(&ctx, output_hash.data());
+
+ // Compare to expected.
+ if (std::memcmp(input_hash.data(), output_hash.data(), NcaSha256HalfHashLength) != 0) {
+ LOG_ERROR(Loader, "NCA hash mismatch detected for file {}", name);
+ return ResultStatus::ErrorIntegrityVerificationFailed;
+ }
+
+ // File verified.
+ return ResultStatus::Success;
+}
+
ResultStatus AppLoader_NCA::ReadRomFS(FileSys::VirtualFile& dir) {
if (nca == nullptr) {
return ResultStatus::ErrorNotInitialized;
diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h
index cf356ce63..96779e27f 100644
--- a/src/core/loader/nca.h
+++ b/src/core/loader/nca.h
@@ -39,6 +39,8 @@ public:
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
+ ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) override;
+
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
ResultStatus ReadProgramId(u64& out_program_id) override;
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp
index f9b2549a3..fe2af1ae6 100644
--- a/src/core/loader/nsp.cpp
+++ b/src/core/loader/nsp.cpp
@@ -117,6 +117,42 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::S
return result;
}
+ResultStatus AppLoader_NSP::VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) {
+ // Extracted-type NSPs can't be verified.
+ if (nsp->IsExtractedType()) {
+ return ResultStatus::ErrorIntegrityVerificationNotImplemented;
+ }
+
+ // Get list of all NCAs.
+ const auto ncas = nsp->GetNCAsCollapsed();
+
+ size_t total_size = 0;
+ size_t processed_size = 0;
+
+ // Loop over NCAs, collecting the total size to verify.
+ for (const auto& nca : ncas) {
+ total_size += nca->GetBaseFile()->GetSize();
+ }
+
+ // Loop over NCAs again, verifying each.
+ for (const auto& nca : ncas) {
+ AppLoader_NCA loader_nca(nca->GetBaseFile());
+
+ const auto NcaProgressCallback = [&](size_t nca_processed_size, size_t nca_total_size) {
+ return progress_callback(processed_size + nca_processed_size, total_size);
+ };
+
+ const auto verification_result = loader_nca.VerifyIntegrity(NcaProgressCallback);
+ if (verification_result != ResultStatus::Success) {
+ return verification_result;
+ }
+
+ processed_size += nca->GetBaseFile()->GetSize();
+ }
+
+ return ResultStatus::Success;
+}
+
ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& out_file) {
return secondary_loader->ReadRomFS(out_file);
}
diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h
index 79df4586a..7ce436c67 100644
--- a/src/core/loader/nsp.h
+++ b/src/core/loader/nsp.h
@@ -45,6 +45,8 @@ public:
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
+ ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) override;
+
ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override;
ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override;
ResultStatus ReadProgramId(u64& out_program_id) override;
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 3a76bc788..12d72c380 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -85,6 +85,40 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::KProcess& process, Core::S
return result;
}
+ResultStatus AppLoader_XCI::VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) {
+ // Verify secure partition, as it is the only thing we can process.
+ auto secure_partition = xci->GetSecurePartitionNSP();
+
+ // Get list of all NCAs.
+ const auto ncas = secure_partition->GetNCAsCollapsed();
+
+ size_t total_size = 0;
+ size_t processed_size = 0;
+
+ // Loop over NCAs, collecting the total size to verify.
+ for (const auto& nca : ncas) {
+ total_size += nca->GetBaseFile()->GetSize();
+ }
+
+ // Loop over NCAs again, verifying each.
+ for (const auto& nca : ncas) {
+ AppLoader_NCA loader_nca(nca->GetBaseFile());
+
+ const auto NcaProgressCallback = [&](size_t nca_processed_size, size_t nca_total_size) {
+ return progress_callback(processed_size + nca_processed_size, total_size);
+ };
+
+ const auto verification_result = loader_nca.VerifyIntegrity(NcaProgressCallback);
+ if (verification_result != ResultStatus::Success) {
+ return verification_result;
+ }
+
+ processed_size += nca->GetBaseFile()->GetSize();
+ }
+
+ return ResultStatus::Success;
+}
+
ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& out_file) {
return nca_loader->ReadRomFS(out_file);
}
diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h
index ff05e6f62..b02e136d3 100644
--- a/src/core/loader/xci.h
+++ b/src/core/loader/xci.h
@@ -45,6 +45,8 @@ public:
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
+ ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) override;
+
ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override;
ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override;
ResultStatus ReadProgramId(u64& out_program_id) override;
diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp
index d707dabe2..93038f161 100644
--- a/src/dedicated_room/yuzu_room.cpp
+++ b/src/dedicated_room/yuzu_room.cpp
@@ -368,9 +368,9 @@ int main(int argc, char** argv) {
if (auto room = network.GetRoom().lock()) {
AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game,
.id = preferred_game_id};
- if (!room->Create(room_name, room_description, bind_address, port, password, max_members,
- username, preferred_game_info, std::move(verify_backend), ban_list,
- enable_yuzu_mods)) {
+ if (!room->Create(room_name, room_description, bind_address, static_cast<u16>(port),
+ password, max_members, username, preferred_game_info,
+ std::move(verify_backend), ban_list, enable_yuzu_mods)) {
LOG_INFO(Network, "Failed to create room: ");
return -1;
}
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index 322c29065..5c127c8ef 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -37,8 +37,6 @@ add_library(input_common STATIC
if (MSVC)
target_compile_options(input_common PRIVATE
- /W4
-
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
diff --git a/src/network/room.cpp b/src/network/room.cpp
index e456ea09c..d87db37de 100644
--- a/src/network/room.cpp
+++ b/src/network/room.cpp
@@ -805,7 +805,7 @@ IPv4Address Room::RoomImpl::GenerateFakeIPAddress() {
std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE
do {
for (std::size_t i = 2; i < result_ip.size(); ++i) {
- result_ip[i] = dis(random_gen);
+ result_ip[i] = static_cast<u8>(dis(random_gen));
}
} while (!IsValidFakeIPAddress(result_ip));
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt
index 07e75f9d8..83b763447 100644
--- a/src/shader_recompiler/CMakeLists.txt
+++ b/src/shader_recompiler/CMakeLists.txt
@@ -245,8 +245,6 @@ target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit)
if (MSVC)
target_compile_options(shader_recompiler PRIVATE
- /W4
-
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
index bec5db173..238fb40e3 100644
--- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp
@@ -74,6 +74,11 @@ spv::ImageFormat GetImageFormat(ImageFormat format) {
throw InvalidArgument("Invalid image format {}", format);
}
+spv::ImageFormat GetImageFormatForBuffer(ImageFormat format) {
+ const auto spv_format = GetImageFormat(format);
+ return spv_format == spv::ImageFormat::Unknown ? spv::ImageFormat::R32ui : spv_format;
+}
+
Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) {
const spv::ImageFormat format{GetImageFormat(desc.format)};
const Id type{ctx.U32[1]};
@@ -1271,7 +1276,7 @@ void EmitContext::DefineImageBuffers(const Info& info, u32& binding) {
if (desc.count != 1) {
throw NotImplementedException("Array of image buffers");
}
- const spv::ImageFormat format{GetImageFormat(desc.format)};
+ const spv::ImageFormat format{GetImageFormatForBuffer(desc.format)};
const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)};
const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)};
const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)};
diff --git a/src/tests/common/ring_buffer.cpp b/src/tests/common/ring_buffer.cpp
index e85f9977b..b6e3bc875 100644
--- a/src/tests/common/ring_buffer.cpp
+++ b/src/tests/common/ring_buffer.cpp
@@ -55,7 +55,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") {
// Pushing more values than space available should partially succeed.
{
std::vector<char> to_push(6);
- std::iota(to_push.begin(), to_push.end(), 88);
+ std::iota(to_push.begin(), to_push.end(), static_cast<char>(88));
const std::size_t count = buf.Push(to_push);
REQUIRE(count == 3U);
}
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
index 454bb66a4..c4c30d807 100644
--- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp
+++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
@@ -66,21 +66,6 @@ std::string BuildCommaSeparatedExtensions(
return fmt::format("{}", fmt::join(available_extensions, ","));
}
-DebugCallback MakeDebugCallback(const vk::Instance& instance, const vk::InstanceDispatch& dld) {
- if (!Settings::values.renderer_debug) {
- return DebugCallback{};
- }
- const std::optional properties = vk::EnumerateInstanceExtensionProperties(dld);
- const auto it = std::ranges::find_if(*properties, [](const auto& prop) {
- return std::strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, prop.extensionName) == 0;
- });
- if (it != properties->end()) {
- return CreateDebugUtilsCallback(instance);
- } else {
- return CreateDebugReportCallback(instance);
- }
-}
-
} // Anonymous namespace
Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld,
@@ -103,7 +88,8 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_,
cpu_memory(cpu_memory_), gpu(gpu_), library(OpenLibrary(context.get())),
instance(CreateInstance(*library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type,
Settings::values.renderer_debug.GetValue())),
- debug_callback(MakeDebugCallback(instance, dld)),
+ debug_messenger(Settings::values.renderer_debug ? CreateDebugUtilsCallback(instance)
+ : vk::DebugUtilsMessenger{}),
surface(CreateSurface(instance, render_window.GetWindowInfo())),
device(CreateDevice(instance, dld, *surface)), memory_allocator(device), state_tracker(),
scheduler(device, state_tracker),
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h
index 89e98425e..590bc1c64 100644
--- a/src/video_core/renderer_vulkan/renderer_vulkan.h
+++ b/src/video_core/renderer_vulkan/renderer_vulkan.h
@@ -35,8 +35,6 @@ class GPU;
namespace Vulkan {
-using DebugCallback = std::variant<vk::DebugUtilsMessenger, vk::DebugReportCallback>;
-
Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld,
VkSurfaceKHR surface);
@@ -75,7 +73,7 @@ private:
vk::InstanceDispatch dld;
vk::Instance instance;
- DebugCallback debug_callback;
+ vk::DebugUtilsMessenger debug_messenger;
vk::SurfaceKHR surface;
ScreenInfo screen_info;
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
index 60a6ac651..e15865d16 100644
--- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
@@ -529,17 +529,20 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
buffer_handles.push_back(handle);
}
if (device.IsExtExtendedDynamicStateSupported()) {
- scheduler.Record([bindings_ = std::move(bindings),
+ scheduler.Record([this, bindings_ = std::move(bindings),
buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
cmdbuf.BindVertexBuffers2EXT(bindings_.min_index,
- bindings_.max_index - bindings_.min_index,
+ std::min(bindings_.max_index - bindings_.min_index,
+ device.GetMaxVertexInputBindings()),
buffer_handles_.data(), bindings_.offsets.data(),
bindings_.sizes.data(), bindings_.strides.data());
});
} else {
- scheduler.Record([bindings_ = std::move(bindings),
+ scheduler.Record([this, bindings_ = std::move(bindings),
buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
- cmdbuf.BindVertexBuffers(bindings_.min_index, bindings_.max_index - bindings_.min_index,
+ cmdbuf.BindVertexBuffers(bindings_.min_index,
+ std::min(bindings_.max_index - bindings_.min_index,
+ device.GetMaxVertexInputBindings()),
buffer_handles_.data(), bindings_.offsets.data());
});
}
diff --git a/src/video_core/vulkan_common/vulkan_debug_callback.cpp b/src/video_core/vulkan_common/vulkan_debug_callback.cpp
index 67e8065a4..448df2d3a 100644
--- a/src/video_core/vulkan_common/vulkan_debug_callback.cpp
+++ b/src/video_core/vulkan_common/vulkan_debug_callback.cpp
@@ -63,22 +63,6 @@ VkBool32 DebugUtilCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
return VK_FALSE;
}
-VkBool32 DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType,
- uint64_t object, size_t location, int32_t messageCode,
- const char* pLayerPrefix, const char* pMessage, void* pUserData) {
- const VkDebugReportFlagBitsEXT severity = static_cast<VkDebugReportFlagBitsEXT>(flags);
- const std::string_view message{pMessage};
- if (severity & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
- LOG_CRITICAL(Render_Vulkan, "{}", message);
- } else if (severity & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
- LOG_WARNING(Render_Vulkan, "{}", message);
- } else if (severity & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
- LOG_INFO(Render_Vulkan, "{}", message);
- } else if (severity & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
- LOG_DEBUG(Render_Vulkan, "{}", message);
- }
- return VK_FALSE;
-}
} // Anonymous namespace
vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance) {
@@ -98,15 +82,4 @@ vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance) {
});
}
-vk::DebugReportCallback CreateDebugReportCallback(const vk::Instance& instance) {
- return instance.CreateDebugReportCallback({
- .sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT,
- .pNext = nullptr,
- .flags = VK_DEBUG_REPORT_DEBUG_BIT_EXT | VK_DEBUG_REPORT_INFORMATION_BIT_EXT |
- VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT,
- .pfnCallback = DebugReportCallback,
- .pUserData = nullptr,
- });
-}
-
} // namespace Vulkan
diff --git a/src/video_core/vulkan_common/vulkan_debug_callback.h b/src/video_core/vulkan_common/vulkan_debug_callback.h
index a8af7b406..5e940782f 100644
--- a/src/video_core/vulkan_common/vulkan_debug_callback.h
+++ b/src/video_core/vulkan_common/vulkan_debug_callback.h
@@ -9,6 +9,4 @@ namespace Vulkan {
vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance);
-vk::DebugReportCallback CreateDebugReportCallback(const vk::Instance& instance);
-
} // namespace Vulkan
diff --git a/src/video_core/vulkan_common/vulkan_instance.cpp b/src/video_core/vulkan_common/vulkan_instance.cpp
index bc16145be..180657a75 100644
--- a/src/video_core/vulkan_common/vulkan_instance.cpp
+++ b/src/video_core/vulkan_common/vulkan_instance.cpp
@@ -76,11 +76,9 @@ namespace {
extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
}
#endif
- if (enable_validation) {
- const bool debug_utils =
- AreExtensionsSupported(dld, std::array{VK_EXT_DEBUG_UTILS_EXTENSION_NAME});
- extensions.push_back(debug_utils ? VK_EXT_DEBUG_UTILS_EXTENSION_NAME
- : VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
+ if (enable_validation &&
+ AreExtensionsSupported(dld, std::array{VK_EXT_DEBUG_UTILS_EXTENSION_NAME})) {
+ extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
}
return extensions;
}
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 8622dc184..fd6bebf0f 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -193,14 +193,10 @@ void ConfigureGraphics::PopulateVSyncModeSelection() {
: vsync_mode_combobox_enum_map[current_index];
int index{};
const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device
- if (device == -1) {
- // Invalid device
- return;
- }
const auto& present_modes = //< relevant vector of present modes for the selected device or API
- backend == Settings::RendererBackend::Vulkan ? device_present_modes[device]
- : default_present_modes;
+ backend == Settings::RendererBackend::Vulkan && device > -1 ? device_present_modes[device]
+ : default_present_modes;
vsync_mode_combobox->clear();
vsync_mode_combobox_enum_map.clear();
@@ -497,11 +493,19 @@ void ConfigureGraphics::RetrieveVulkanDevices() {
}
Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
- if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
- return Settings::values.renderer_backend.GetValue(true);
+ const auto selected_backend = [&]() {
+ if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
+ return Settings::values.renderer_backend.GetValue(true);
+ }
+ return static_cast<Settings::RendererBackend>(
+ combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index())
+ .at(api_combobox->currentIndex())
+ .first);
+ }();
+
+ if (selected_backend == Settings::RendererBackend::Vulkan &&
+ UISettings::values.has_broken_vulkan) {
+ return Settings::RendererBackend::OpenGL;
}
- return static_cast<Settings::RendererBackend>(
- combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index())
- .at(api_combobox->currentIndex())
- .first);
+ return selected_backend;
}
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp
index 7721e58f9..d63093985 100644
--- a/src/yuzu/configuration/shared_widget.cpp
+++ b/src/yuzu/configuration/shared_widget.cpp
@@ -194,7 +194,7 @@ QWidget* Widget::CreateRadioGroup(std::function<std::string()>& serializer,
return group;
}
- const auto get_selected = [=]() -> u32 {
+ const auto get_selected = [=]() -> int {
for (const auto& [id, button] : radio_buttons) {
if (button->isChecked()) {
return id;
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index b5a02700d..6842ced3e 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -557,6 +557,7 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
QMenu* dump_romfs_menu = context_menu.addMenu(tr("Dump RomFS"));
QAction* dump_romfs = dump_romfs_menu->addAction(tr("Dump RomFS"));
QAction* dump_romfs_sdmc = dump_romfs_menu->addAction(tr("Dump RomFS to SDMC"));
+ QAction* verify_integrity = context_menu.addAction(tr("Verify Integrity"));
QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard"));
QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry"));
#ifndef WIN32
@@ -628,6 +629,8 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri
connect(dump_romfs_sdmc, &QAction::triggered, [this, program_id, path]() {
emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::SDMC);
});
+ connect(verify_integrity, &QAction::triggered,
+ [this, path]() { emit VerifyIntegrityRequested(path); });
connect(copy_tid, &QAction::triggered,
[this, program_id]() { emit CopyTIDRequested(program_id); });
connect(navigate_to_gamedb_entry, &QAction::triggered, [this, program_id]() {
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 6c2f75e53..8aea646b2 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -113,6 +113,7 @@ signals:
void RemoveFileRequested(u64 program_id, GameListRemoveTarget target,
const std::string& game_path);
void DumpRomFSRequested(u64 program_id, const std::string& game_path, DumpRomFSTarget target);
+ void VerifyIntegrityRequested(const std::string& game_path);
void CopyTIDRequested(u64 program_id);
void CreateShortcut(u64 program_id, const std::string& game_path,
GameListShortcutTarget target);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index f2e6c03f0..9cea60c32 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -442,8 +442,13 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan
"#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>"
"here for instructions to fix the issue</a>."));
+#ifdef HAS_OPENGL
Settings::values.renderer_backend = Settings::RendererBackend::OpenGL;
+#else
+ Settings::values.renderer_backend = Settings::RendererBackend::Null;
+#endif
+ UpdateAPIText();
renderer_status_button->setDisabled(true);
renderer_status_button->setChecked(false);
} else {
@@ -1447,6 +1452,8 @@ void GMainWindow::ConnectWidgetEvents() {
&GMainWindow::OnGameListRemoveInstalledEntry);
connect(game_list, &GameList::RemoveFileRequested, this, &GMainWindow::OnGameListRemoveFile);
connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS);
+ connect(game_list, &GameList::VerifyIntegrityRequested, this,
+ &GMainWindow::OnGameListVerifyIntegrity);
connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID);
connect(game_list, &GameList::NavigateToGamedbEntryRequested, this,
&GMainWindow::OnGameListNavigateToGamedbEntry);
@@ -2275,40 +2282,62 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path));
}
-static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) {
- std::size_t out = 0;
-
- for (const auto& subdir : dir->GetSubdirectories()) {
- out += 1 + CalculateRomFSEntrySize(subdir, full);
- }
-
- return out + (full ? dir->GetFiles().size() : 0);
-}
-
-static bool RomFSRawCopy(QProgressDialog& dialog, const FileSys::VirtualDir& src,
- const FileSys::VirtualDir& dest, std::size_t block_size, bool full) {
+static bool RomFSRawCopy(size_t total_size, size_t& read_size, QProgressDialog& dialog,
+ const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest,
+ bool full) {
if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable())
return false;
if (dialog.wasCanceled())
return false;
+ std::vector<u8> buffer(CopyBufferSize);
+ auto last_timestamp = std::chrono::steady_clock::now();
+
+ const auto QtRawCopy = [&](const FileSys::VirtualFile& src_file,
+ const FileSys::VirtualFile& dest_file) {
+ if (src_file == nullptr || dest_file == nullptr) {
+ return false;
+ }
+ if (!dest_file->Resize(src_file->GetSize())) {
+ return false;
+ }
+
+ for (std::size_t i = 0; i < src_file->GetSize(); i += buffer.size()) {
+ if (dialog.wasCanceled()) {
+ dest_file->Resize(0);
+ return false;
+ }
+
+ using namespace std::literals::chrono_literals;
+ const auto new_timestamp = std::chrono::steady_clock::now();
+
+ if ((new_timestamp - last_timestamp) > 33ms) {
+ last_timestamp = new_timestamp;
+ dialog.setValue(
+ static_cast<int>(std::min(read_size, total_size) * 100 / total_size));
+ QCoreApplication::processEvents();
+ }
+
+ const auto read = src_file->Read(buffer.data(), buffer.size(), i);
+ dest_file->Write(buffer.data(), read, i);
+
+ read_size += read;
+ }
+
+ return true;
+ };
+
if (full) {
for (const auto& file : src->GetFiles()) {
const auto out = VfsDirectoryCreateFileWrapper(dest, file->GetName());
- if (!FileSys::VfsRawCopy(file, out, block_size))
- return false;
- dialog.setValue(dialog.value() + 1);
- if (dialog.wasCanceled())
+ if (!QtRawCopy(file, out))
return false;
}
}
for (const auto& dir : src->GetSubdirectories()) {
const auto out = dest->CreateSubdirectory(dir->GetName());
- if (!RomFSRawCopy(dialog, dir, out, block_size, full))
- return false;
- dialog.setValue(dialog.value() + 1);
- if (dialog.wasCanceled())
+ if (!RomFSRawCopy(total_size, read_size, dialog, dir, out, full))
return false;
}
@@ -2653,10 +2682,9 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
}
const auto full = res == selections.constFirst();
- const auto entry_size = CalculateRomFSEntrySize(extracted, full);
- // The minimum required space is the size of the extracted RomFS + 1 GiB
- const auto minimum_free_space = extracted->GetSize() + 0x40000000;
+ // The expected required space is the size of the RomFS + 1 GiB
+ const auto minimum_free_space = romfs->GetSize() + 0x40000000;
if (full && Common::FS::GetFreeSpaceSize(path) < minimum_free_space) {
QMessageBox::warning(this, tr("RomFS Extraction Failed!"),
@@ -2667,12 +2695,15 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
return;
}
- QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0,
- static_cast<s32>(entry_size), this);
+ QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, 100, this);
progress.setWindowModality(Qt::WindowModal);
progress.setMinimumDuration(100);
+ progress.setAutoClose(false);
+ progress.setAutoReset(false);
- if (RomFSRawCopy(progress, extracted, out, 0x400000, full)) {
+ size_t read_size = 0;
+
+ if (RomFSRawCopy(romfs->GetSize(), read_size, progress, extracted, out, full)) {
progress.close();
QMessageBox::information(this, tr("RomFS Extraction Succeeded!"),
tr("The operation completed successfully."));
@@ -2684,6 +2715,54 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
}
}
+void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) {
+ const auto NotImplemented = [this] {
+ QMessageBox::warning(this, tr("Integrity verification couldn't be performed!"),
+ tr("File contents were not checked for validity."));
+ };
+ const auto Failed = [this] {
+ QMessageBox::critical(this, tr("Integrity verification failed!"),
+ tr("File contents may be corrupt."));
+ };
+
+ const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read));
+ if (loader == nullptr) {
+ NotImplemented();
+ return;
+ }
+
+ QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this);
+ progress.setWindowModality(Qt::WindowModal);
+ progress.setMinimumDuration(100);
+ progress.setAutoClose(false);
+ progress.setAutoReset(false);
+
+ const auto QtProgressCallback = [&](size_t processed_size, size_t total_size) {
+ if (progress.wasCanceled()) {
+ return false;
+ }
+
+ progress.setValue(static_cast<int>((processed_size * 100) / total_size));
+ return true;
+ };
+
+ const auto status = loader->VerifyIntegrity(QtProgressCallback);
+ if (progress.wasCanceled() ||
+ status == Loader::ResultStatus::ErrorIntegrityVerificationNotImplemented) {
+ NotImplemented();
+ return;
+ }
+
+ if (status == Loader::ResultStatus::ErrorIntegrityVerificationFailed) {
+ Failed();
+ return;
+ }
+
+ progress.close();
+ QMessageBox::information(this, tr("Integrity verification succeeded!"),
+ tr("The operation completed successfully."));
+}
+
void GMainWindow::OnGameListCopyTID(u64 program_id) {
QClipboard* clipboard = QGuiApplication::clipboard();
clipboard->setText(QString::fromStdString(fmt::format("{:016X}", program_id)));
@@ -3770,10 +3849,14 @@ void GMainWindow::OnToggleAdaptingFilter() {
void GMainWindow::OnToggleGraphicsAPI() {
auto api = Settings::values.renderer_backend.GetValue();
- if (api == Settings::RendererBackend::OpenGL) {
+ if (api != Settings::RendererBackend::Vulkan) {
api = Settings::RendererBackend::Vulkan;
} else {
+#ifdef HAS_OPENGL
api = Settings::RendererBackend::OpenGL;
+#else
+ api = Settings::RendererBackend::Null;
+#endif
}
Settings::values.renderer_backend.SetValue(api);
renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 668dbc3b1..1e4f6e477 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -313,6 +313,7 @@ private slots:
void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target,
const std::string& game_path);
void OnGameListDumpRomFS(u64 program_id, const std::string& game_path, DumpRomFSTarget target);
+ void OnGameListVerifyIntegrity(const std::string& game_path);
void OnGameListCopyTID(u64 program_id);
void OnGameListNavigateToGamedbEntry(u64 program_id,
const CompatibilityList& compatibility_list);
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index d0433ffc6..c1695cc6e 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -265,7 +265,7 @@ int main(int argc, char** argv) {
password = match[2];
address = match[3];
if (!match[4].str().empty())
- port = std::stoi(match[4]);
+ port = static_cast<u16>(std::stoi(match[4]));
std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$");
if (!std::regex_match(nickname, nickname_re)) {
std::cout